-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Please, help me about this case:
<textbox id="family_name" value="@bind(fx.subjVersion.familyNameLat.original)"></textbox>
I work with Hibernate. In the database subjVersion have foreign key to familyNameLat (table), which have column "original (String)".
So the problem is:
when in subjVersioin table row, column familyNameLat is null and .zul form is generated, the component "<textbox id="family_name" ......"="" was="" associated="" with="" a="" null="" object.="" <="" p="">
And when I try to submit form throws this exception: "Target Unreachable, 'firstNameLat' returned null".
How to resolve this issue?
I work with MVVM.
You are using form binding. Therefor take into account that there is also an intermediate object generated(POJO like) right? Thus this object is automatically handled by zk framework and you should handle in a specific manner described in the tutorial for form binding. On top of that the @bind() you must have initialized an object to map the @bind values or you are binding to the null object. The solution would be on the @Init to check if the entity you want to represent in the form is null and if such create a new instance of it. A bit different story if you want to do and update in that case on the select of the entity to update you have to map the entity say customer = findCustomer(id) and bind the information to the form using the data binding mechanism.
PUSH PUSH PUSH!
Please give us an answer with codes for this really 'real world' sample. This should be handled in the documentation.
thanks Stephan
<div form="@id('fx') @init(vm.myForm) @load(vm.selectedRecord) @save(vm.selectedRecord, before='onSave')">
. . .
<textbox value="@bind(fx.customer.name1) @validator(vm.oxValidatorNotNull)" readonly="true" hflex="1" />
Target unreachable, 'customer' returned null
--> The validator is never called
selectedRecord=project
project.customer.name1
Ok. After thinking about the error i should say that this is not a zk or binder issue.
By using a deeper path of the properties like 'project.customer.name' the user/developer must ensure that the bean that holds the property 'name' is not null.
I do it now by setting a new empty 'customer' object before the binder have acces to it.
thanks Stephan
Asked: 2012-06-06 12:12:50 +0800
Seen: 259 times
Last updated: May 11 '14