You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by madan chowdary <ma...@yahoo.com> on 2007/03/11 09:11:16 UTC
[ Tobago ] No Page Refresh while validation
Hi All,
I have a form in which the user has to enter some data and then submit the form.
If at all he misses anything , he should be informed that all fields are required.
To do this , i used validator attribute in the form elements.
But this validation does a page refresh and then shows the errors in <tc:message> or <tc:messages/>
But i was asked to do the validation without page refresh, in a javascript alert message, and the message should be i18n format.
I used the "onclick" attribute and called a javascript function which gives a alert if any field is empty.
But how can i show the messages in i18n format. Validation error will differ based upon the validations i do. so the alert message should be shown to the user based upon his locale set.
How can i achieve this ?
thnx in advance
Regards,
Madan
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/
Re: [ Tobago ] No Page Refresh while validation
Posted by Jörn Zaefferer <jo...@googlemail.com>.
JavaScript based form-validation should always start with the submit event:
When a user presses enter inside one form field, the form is submitted
without triggering your onclick event.
In your case it should be possible to use JSF's built-in localization
features. You'd have to somehow render that message into your JavaScript
when rendering the view.