Issue 12 in jquery-validation-ui-plugin: Unique validation don't work for update

18 views
Skip to first unread message

jquery-valida...@googlecode.com

unread,
Apr 5, 2011, 6:17:33 AM4/5/11
to jquery-valida...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 12 by keso...@gmail.com: Unique validation don't work for update
http://code.google.com/p/jquery-validation-ui-plugin/issues/detail?id=12

What steps will reproduce the problem?
1. Create a domain class and add it a property with an "unique" constraint
2. In edit.gsp add the <jqvalui:renderValidationScript /> tag
3. Try to submit the form

What is the expected output? What do you see instead?
The succerful submit. Instead, after the unique field appear the error
message message related to not uniqueness of field.

What version of the product are you using? On what operating system?
Grails 1.3.7
jquery-validation-ui-plugin 1.2.1

Please provide any additional information below.

if was applied an "unique" constraint on a domain class,
jquery-validation-ui-plugin generate a "remote" client-side validation.
This work fine for create fase, but not for edit one, because actually it
do not pass to controller the id of the edited instance.

I've attached controller and taglib with some little modification for fix
the problem. The trick rely on convention that in edit.gsp form the id of
instance was an <input type="hidden" id="id" name="id" />.

Attachments:
JQueryRemoteValidatorController.groovy 2.5 KB
JQueryValidationUiTagLib.groovy 31.0 KB

jquery-valida...@googlecode.com

unread,
Apr 5, 2011, 6:38:42 AM4/5/11
to jquery-valida...@googlegroups.com

Comment #1 on issue 12 by limchee...@vobject.com: Unique validation don't

Thanks for reporting the issue. I not sure I am understand the issue well.
Great that you can fix it yourself and submit the fix. By the way, if you
don't need client validation for specific property, you can specified it
in "not" attribute of the <jqvalui:renderValidationScript /> tag, you can
find out more here
http://code.google.com/p/jquery-validation-ui-plugin/#Tags

jquery-valida...@googlecode.com

unread,
Apr 6, 2011, 8:49:39 AM4/6/11
to jquery-valida...@googlegroups.com

Comment #2 on issue 12 by keso...@gmail.com: Unique validation don't work
for update
http://code.google.com/p/jquery-validation-ui-plugin/issues/detail?id=12

Hi,
sorry for my unclear explanation.

The problem is: if you apply an "unique" constraint on your domain class,
jquery-validation-ui plugin generate correctly client-side rule of
type "remote" (AJAX call to JQueryRemoteValidator/validate action). But, if
you use such approach for an edit form, you need to communicate to the
JQueryRemoteValidator/validate action the ID of entity that you are
editing, otherwise the unique validation always fails.

Take a look at attached JQueryRemoteValidatorController.groovy for see what
I'm talking about.

Instead, in JQueryValidationUiTagLib.groovy (at row 423) you can see the
trick I used for pass the ID to the JQueryRemoteValidatorController.

jquery-valida...@googlecode.com

unread,
Apr 6, 2011, 9:26:01 AM4/6/11
to jquery-valida...@googlegroups.com

Comment #3 on issue 12 by limchee...@vobject.com: Unique validation don't

Thanks for further explanation. I understand better now. I will look into
it.

jquery-valida...@googlecode.com

unread,
May 20, 2011, 5:22:24 AM5/20/11
to jquery-valida...@googlegroups.com

Comment #4 on issue 12 by keso...@gmail.com: Unique validation don't work
for update
http://code.google.com/p/jquery-validation-ui-plugin/issues/detail?id=12

Hi, no interest in this fix? We are really constrained to fork the plugin
for use it in our projects? :(

jquery-valida...@googlecode.com

unread,
May 20, 2011, 9:34:27 AM5/20/11
to jquery-valida...@googlegroups.com
Updates:
Status: Accepted

Comment #5 on issue 12 by limchee...@vobject.com: Unique validation don't

Sorry for long delay, I will look into it over this weekend.


jquery-valida...@googlecode.com

unread,
May 21, 2011, 12:31:50 AM5/21/11
to jquery-valida...@googlegroups.com
Updates:
Status: Fixed

Comment #6 on issue 12 by limchee...@vobject.com: Unique validation don't

Incorporated your code to 1.2.2 released with minor changes: rename the
currentId to id. Please verify.

jquery-valida...@googlecode.com

unread,
May 21, 2011, 3:53:39 AM5/21/11
to jquery-valida...@googlegroups.com

Comment #7 on issue 12 by keso...@gmail.com: Unique validation don't work
for update
http://code.google.com/p/jquery-validation-ui-plugin/issues/detail?id=12

Work well!

Many thanks for your great job!

Gennaro

jquery-valida...@googlecode.com

unread,
May 21, 2011, 6:57:04 AM5/21/11
to jquery-valida...@googlegroups.com
Updates:
Status: Verified

Comment #8 on issue 12 by limchee...@vobject.com: Unique validation don't

Hi Gennaro,

You're welcome and thanks for verification.


Reply all
Reply to author
Forward
0 new messages