User login

Check for duplicate titles of a node with AJAX to warn immediately before entering more data or submitting

Attached is a custom module that piggybacks on Unique Field and steals most of its other code from username_checkUsername Check.

Commit message: "Working Unique Field AJAX enhancement for node titles. Pretty sweet. It doesn't take away the duplicate warning when you change the title to not be duplicate, but it does change to a green checkmark (courtesy of the username_check module from which I also stole most of the code)."

Below, tales from

The Making Of...

Not quite an answer but somehow our own site comes up:
http://agaric.com/note/pre-validation-forms-jquery-alphanumeric-check

http://www.stellapower.net/content/ajax-ifying-drupal-node-forms

Others want it too:

Modules » Unique field » Issues
AJAX checking?
http://drupal.org/node/518584

And looks like exactly the tutorial i need:
How use AJAX in DRUPAL
http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=639
(the tech is better than the English)

And finally, the Drupal example to steal from!

http://drupal.org/project/username_check

Aside from necessary changes we did things slightly more the Drupal way by using drupal_json where applicable.

Update:

The second attached file, ufajax2.tar__.gz, contains a substantial (and messy, code-duplicating) addition to the previous version: It will check for the combination of unique fields as defined in Unique Fields settings and post a message about this to a specified field.

Also, it contains a fix to the Title uniqueness check to not report a duplicate for the current node when editing it.

Change the second part of this definition to the field ID you want the message to show below:
define('UFAJAX_CHECK_FIELD', 'field_credit_kickers');

Note that you probably do not want to configure Unique Fields to check for the uniqueness of the title (as throwing it in there greatly increases the likelihood that the combination check will always be unique). The module will continue to display a message for the Title regardless of Unique Fields' configuration and enforcement. Instead, set the Unique Fields configuration to check the fields you care about and be sure to specify "The combination of values from the specified fields must be unique" for "Choose whether values must be unique individually or in combination".

This is horrible, hacky, never-want-to-look-at-it-again code. Please look toward http://drupal.org/project/formmsgs for a forthcoming Drupal 7 solution.

Searched words: 
drupal jquery field checker jquery check contents of field jquery check for duplicate jquery prevent duplicate jquery check username availability