• I need someone to help me not to let me create duplicate names. In real time. In case of duplicate give a duplicate alert and not submit the registration.

    <?php $test3 = get_post_meta( get_the_ID(), 'itunes_songs', true ); ?> 
    
    <input class="textfield" id="test2" type="text"  data-type="text" name="test" value="<?php echo $test3 ?>" size="40" >
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Make an Ajax request from the onchange event of the “test” field that sends the entered name to your server side Ajax handler. The handler makes a DB query for meta values under the “itunes_songs” key. If any data is found, the name is already in use. Echo out some sort of error value that your jQuery code will recognize as the need to put up an alert and perhaps disable the submit button or something.

    If no match is found in the DB, Echo out a success value of some sort that your jQuery will recognize as meaning the name is acceptable and the full submittal may proceed. And enable the submit button if it was previously disabled.

Viewing 1 replies (of 1 total)
  • The topic ‘don’t let duplicate ajax field’ is closed to new replies.