0

Constraint "not empty" only on form submit

asked 2013-08-20 02:47:52 +0800

pandukish gravatar image pandukish
68 1 1 4

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

delete flag offensive retag edit

Comments

Hi Robert,

Yes this is want i am looking for.

Regards, Kishore

pandukish ( 2013-08-29 08:15:28 +0800 )edit

3 Answers

Sort by » oldest newest most voted
1

answered 2013-08-22 07:35:46 +0800

cor3000 gravatar image cor3000
6280 2 7

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

link publish delete flag offensive edit
0

answered 2013-08-24 04:02:33 +0800

pandukish gravatar image pandukish
68 1 1 4

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

link publish delete flag offensive edit
0

answered 2013-08-28 11:17:00 +0800

cor3000 gravatar image cor3000
6280 2 7

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

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-08-20 02:47:52 +0800

Seen: 115 times

Last updated: Aug 29 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More