Reputation: 1254
I Have a simple task that turned out to be not son simple ....I.e to Validate an input jsp form in spring hibernate based frame work...in that page i have to validate a text field (required,only English characters,unique(no repeat values should be inserted in db )
Fortunately i completed required & only English Characters validation now i am trying the other one for hours ..
for unique values ie(no repeated values should be saved in database) so validation should trigger a error message when we save the input page with same value in code field...
Help Me
Upvotes: 0
Views: 1063
Reputation: 3171
To check for unique value you can do it in following ways.
Note: In case 1 and 2 if user submits the values even though you are showing value in use you have to stop it from being processed on server. Firebug and other javascript UI tools make it easy to by pass javascript easily.
As checking for unique value can be done on server side only. Ajax checking is the only way which can make it more intuitive and user friendly but you cannot neglect server side checks.
Hope this helps!!!!
Upvotes: 2
Reputation: 22720
IMHO jQuery can't help you to identify if values is present in database. You have to check it on server side.
Are you using any validation on server side like JSR 303? (You must keep server side validations along with client side validations)
Upvotes: 1