Click to See Complete Forum and Search --> : Validate duplicate entries
florida
08-12-2003, 11:07 AM
I need to do a validation of duplicate entries in a field. Please advise how I can do this.
if (theform.fieldhere.value == ???)
{
alert("Data already exists");
return false;
}
Are you validating numbers, words, or what?
[J]ona
florida
08-12-2003, 11:36 AM
Validating number input
What exactly are you looking to do? Do you want to check if the numbers they are entering are already in the field (ie. only them enter each number once)?
florida
08-12-2003, 11:56 AM
The numbers are stored in a text file and I want to make sure the same number is not entered for the same date:
ID Date Number
1 20030811 23 //this is okay
2 20030812 23 //this is okay
3 20030812 56 //this is okay
4 20030812 56 //this number 56 is a dup
In the number column the Number can not be the same for each Date. So the number 56 should not be duplicated because there are two number 56 for the 20030812 Date.
I would like to create a duplicate check for the number column. Any way I can do that??
It'd be more "secure" to do it in PHP... That way you could search through the file (even though it'd be easier if you used a database), and simply see if it's already there or not. Plus, it'd work for those without JavaScript or those malicious people who find it amusing to cause problems.
[J]ona
florida
08-12-2003, 12:29 PM
I dont really need security on this as it is not used by many and would rather do it in JavaScript if possible. Please advise if possible?
Thanks!
Now the question is, how would the JavaScript even know if it's a duplicate? Unless the PHP reads from the file and puts it into a JavaScript variable, but for that much you may as well do it in PHP...
[J]ona
florida
08-12-2003, 12:51 PM
Thanks Jona for all your assistance. I am not familiar with PHP. I could also do the same thing with Perl? We dont have any servers with PHP here.
You can do it with just about any server-side language that exists.
[J]ona