I have a dynamically generated form with multiple text input fields:
<input class="w200" type="text" value="" name="field[7018]">
<input class="w200" type="text" value="" name="field[7019]">
<input class="w200" type="text" value="" name="field[7020]">
...
<input class="w200" type="text" value="" name="field[7055]">
Using jQuery, how can I detect duplicate values on input?
There's a post on SO that proposes the following solution:
$("#check").click(function() {
$.post("checkname.php",
{ name : $("#textboxname").val() },
function(data) {
//data will contain the output from the file `checkname.php`
if(data=="ok") { //imagine the case it output ok if not duplicate is found
alert('ok');
else {
alert('duplicate name exists');
}
);
});
It works if a use enters one value at a time. But what if the user gets opens a form with prepopulated values, to edit them. How would I check for duplicates then?