0

Bind a empty textbox value

asked 2014-07-14 04:50:11 +0800

JustinFrost gravatar image JustinFrost
139 1 6

I have a textbox with a 'no empty' constraint. My problem is that the value of this text box is not saving to the view model, is there anyway around this ?

<textbox constraint="no empty" onOK="@command('doLogin')" value="@load(vm.userName) @save(vm.userName, before='doLogin')" tabindex="1"/>
delete flag offensive retag edit

Comments

This looks correct, can you make a simple fiddle to demonstrate the issue (when putting link plz tell zk version)?

chillworld ( 2014-07-14 06:53:43 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-07-14 13:56:28 +0800

JustinFrost gravatar image JustinFrost
139 1 6

Hi, sorry I should clarify that the value is not saved to the viewmodel when it is empty. I need to pass through blank values and also validate them on the client using the "no empty" constraint. This is because I have a login button that does further validation.

link publish delete flag offensive edit
0

answered 2014-07-14 19:59:17 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9
https://github.com/chillw...

Hi Justin,

This is normal cause the constraint="no empty" does already client side validation.
If you only want to have server side validation, you can check in your command for null and throw a WrongValueException with as argument the tekst you want to show.
Then you can remove the constraint in the textbox.

Greetz chill.

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: 2014-07-14 04:50:11 +0800

Seen: 25 times

Last updated: Jul 14 '14

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