-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi All,
How could I display the error message(error box) on click of submit/save button instead of onchage/onfocus/onblur or coming out of text box. Which is displaying all validation error messages at a time and screen is looking ugly. Would any one of you suggest me how to achieve this?
I am MVVM pattern for my application.
Thanks In advance
Regards, Pandukish
Hi Pandukish,
you can defer the updates to the viewmodel using the @save bind annotation like this: @save(vm.property, before='commandName')
e.g.
<textbox value="@load(vm.username) @save(vm.username, before='login') @validator..." />
<textbox value="@load(vm.password) @save(vm.password, before='login') @validator..." />
<button label="login" onClick="@command('login')" />
Now values will only be saved (and validate) right before the 'login' command is executed, preventing the command in case validation fails. see Data Binding Documentation
Alternatively you could look into form binding with form validation
If this does not cover what you are looking for, can you please provide a sample demonstrating your problem?
Cheers, Robert
Hi Robert,
Thanks for the reply.
I am able to display the validation messages by using validator before command execution but which is server side validation. I wanted to perform mandatory validations at client side itself instead of server side. By using "not empty" constraint I am able to achieve this but its displaying the error messages/validating onfocus out of text box which I don't want.
Want to display the those error messages(popup/tooltip) on click of "Save" button instead of onfocus out of textbox.
Hope it clarifies the question. Please let me know if you need any further details.
Regards, Pandukish
Hi Pandukish,
I understand now... based on this thread I created the following running example on ZK fiddle which I think is going half the way, skipping the client side validation (during onBlur), until the button is pressed. But still the server responds with the error messages.
If that is somewhere near what you want I'll have a look how to trigger the client validation before the AJAX Request, saving the server round trip.
Regards Robert
Asked: 2013-08-20 02:47:52 +0800
Seen: 115 times
Last updated: Aug 29 '13
Hi Robert,
Yes this is want i am looking for.
Regards, Kishore
pandukish ( 2013-08-29 08:15:28 +0800 )edit