Now, module has this smooth flow:
- user type in for example node title
- user hit save
- module check if it is original - if not, display error message
Better workflow is to check originality of field before node is submitted using ajax:
- as soon as user leave field (focus off), ajax will check if field is uniqe.
You can take code inspiration from module Username originality AJAX check.
I found this in Username originality AJAX check issues: https://drupal.org/node/1399360 - Reproduce the same functionality as username check on fields
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1926346-unique_field_ajaxification-2.patch | 10.84 KB | reubenavery |
Comments
Comment #1
reubenavery commentedI'll take this on. Patch to come shortly.
Comment #2
reubenavery commentedAnd here we go. Note there is a new setting field on the content type's unique field settings pane which specifies the field onto which we attach the AJAX call.
Comment #3
mrvee commentedAwesome, thank you reubidium, this worked great for me.
Comment #4
zilla commentedvery cool - will this get rolled in a dev release soon?
Comment #5
zilla commentedbump: any idea if this will make it to a dev release? seems that last update was 2011
Comment #5.0
zilla commenteddsf
Comment #6
Coupon Code Swap commentedThe patch in #2 works quite well. I have a couple of suggestions.
1. It would be good to only do checking if a field has not been left empty. I have two fields I use in combination to validate uniqueness. The way it is now, if one field is filled and the other field is left empty and loses focus, the error message is displayed for every node that has been posted with the combination, regardless of uniqueness.
2. By default, it would be better to place the error message in the usual Drupal $messages area, rather than on the field. Having it set on the field causes other inputs in the form to jump around in akward ways when the message is displayed. If this were configurable for either $messages area or field, it would be ideal.
Comment #7
kopeboyCan we have an update on this please? :)
I am not sure I can help cause I am not a developer, but this is a very important feature!
About the latest suggestions:
Comment #8
joshbudda commentedLOVE this patch so thank you for that!
I'm having an issue where I need ajax to validate more than one field. Is that possible?
In other words, rather than having a select list that can only select one field for "Attach AJAX preview to field" it would be amazing to have checkboxes so the user can select multiple fields.
Comment #9
hockey2112 commentedTrying to implement this patch, but I am unclear on this part:
Is this a new file that needs to be added? If not, where can I find this "iv_persona_helper" custom module?
Comment #10
hockey2112 commentedI added this patch (minus the "iv_persona_helper" part) to unique_field-7.x-1.0-rc1, but it is not adding the AJAX effect. I am using the "Seven" admin theme, and also tested it with Garland.
Comment #11
Realeiko commented@hockey2112, I've done the same process, and it works like a charm. Be aware that it needs a little configuration in the content type:
By default it is disabled ;)
+1 to add an option to choose to report to message area instead to a field attach.
And any idea if this will make it to a dev release?
By the way, this module is freaking awesome usefull! And with this patch is a the ultimate productivity booster! Good job guys! Thank you!
Comment #12
astonvictor commentedI'm closing it because the issue was created a long time ago without any further steps.
if you still need it then raise a new one.
thanks