-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I've a big form and a lot of dynamic settings in it.
For exemple when the user pick something in a combobox, I've to go fetch data in the database to fill a listbox. When the user type something in a text field, I've to add the item in a combobox etc ...
So I'm calling my VM quite a bit, from either Setters or Command. I want the validation to be only active when the user click the SAVE button at the end of the form.
And then I wanna display validation error on each fields, either format error or database constraint related error.
I've read http://books.zkoss.org/zk-mvvm-book/7.0/data_binding/validator.html but it turns out that in both Property Binding & Save Before Command approach, there is "Not save data to ViewModel".
I want my form to save to view model even if it's not ok, because i would like to do the validation only when the user Click, but still have access to the bean and not use a mid-layer build.
Maybe a way to do it, would be to bind it at the same time to my VM bean and to a mid-layer form bean?
Hoping I didn't make too much of a mess of this message and that someone can help me.
Regards,
EDIT: Kinda cheated and did :
<grid form="@id('offreValidation') @load(vm.offer) @save(vm.offer, before='validate')
@validator('com.orange.octave.web.viewmodels.contrat.detail.offreentite.validator.OffreCreationValidator', offreValidation=vm.offer)">
Asked: 2015-06-19 15:48:52 +0800
Seen: 19 times
Last updated: Jun 19 '15
Databinding and auto-complete on combobox
Composite component and bind in ZK 6
How to detach / reattach MVVM windows?
Is there a way to resolve view model properties as input to client side javascripts?
How can I synchronize data in a ListBox in MVVM ? [closed]
MVVM Validator: class not found ? [closed]
How to Call Child ViewModel Method from Parent Window? [closed]
willeam, maybe you can use this approach better : throw a
chillworld ( 2015-06-21 08:31:08 +0800 )editWrongValueException
in the setter. (like this you can still save to the vm)Hey Chill, thanks for your reply. I'll check it out.
WilliamB ( 2015-06-22 09:04:09 +0800 )editWell thje issue is, I don't have access to the component in the setter. I could always wire them in the VM but it's kinda dirty isn't it?
WilliamB ( 2015-06-22 20:43:35 +0800 )edit@SelectorParam can retrieve components based on css3 selector. Thats mvvm style.
chillworld ( 2015-06-22 21:51:30 +0800 )editThanks Chill didn't know about that one.
WilliamB ( 2015-06-23 15:31:10 +0800 )edit