Possibility to enable Ajax check for fields marked as unique?

Cheers,
G

Comments

carl ditzler’s picture

I also have a need for this :

Field is unique
User enters content in the field on the add page
Module finds completed field is duplicate/not unique
Notification displays next to field that content is not unique

Ideally, we could define the notification message via Admin as the notification should be unique to the purpose of the field.

paganwinter’s picture

Subscribing...

thekayra’s picture

Very nice module, congratz..

Would be very nice if this would warn the users as described above but with the option of letting them continue.

mlncn’s picture

Status: Active » Needs work
Issue tags: +Usability, +Ajax

Robust AJAX checking of all the things in all the ways that Unique Field does was beyond my time right now (and in the forseeable future) but here is a custom module that piggybacks on Unique Field and steals most of its other code from username_checkUsername Check to check if the title already exists within a given node type.

Download Unique Field AJAX from our notes site.

It is dead simple to modify for use for other content types (edit the array that holds "effect" in our example) and pretty easy to apply to different fields. Agaric is interested in helping generalize it and seeing about better integration with Unique Field– our next need will be checking Link fields for existing links with AJAX, complicated by the possibility of these links being filled in already by prepopulate and a bookmarklet...)

benjamin, agaric

Coupon Code Swap’s picture

Hi Benjamin. I am able to adjust ufajax.module so that the check mark shows up next to a custom CCK field I have defined. However, I am not able to get it to actually check the corresponding database entry. Does the ufajax.js file need to be modified as well?

mlncn’s picture

Even though the function is called title throughout, one should only have to make changes in the module file, not the javascript, as far as I can recall or see looking at it now. You will need to change or replace ufajax_check_title().

lelizondo’s picture

subscribing

c-c-m’s picture

subscribing too

dobe’s picture

Ok, I have successfully utilized the ufajax for a custom CCK text field. In order to do it, this is what I had to do. Since it is fairly difficult to apply #prefix and #suffix information to a CCK field, at least with my knowledge of CCK and FAPI it is. I downloaded http://drupal.org/project/form_markup this allows that information to be configured while editing the field it self. Then I put the following information in those areas:

Prefix: <div id="ufajax-wrapper">
Suffix: </div><div id="ufajax-message"></div><div id="ufajax-informer" class="ufajax-informer">&nbsp;</div>

Make sure you change the array line on 28 of the ufajax.module to the content types your field is in that need the ajax functionality for example if your content field is on the "page" content type and the "story" content type you would change it to:

$types = array('page', 'story');

Hope this helps.

Coupon Code Swap’s picture

Benjamin with Agaric is working on a comprehensive solution for this. If you have suggestions for the project, please post them here:

http://drupal.org/project/formmsgs

giorgio79’s picture

Status: Needs work » Closed (duplicate)

Looks what we need :)

momper’s picture

subscribe