-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello everybody,
I have a kind of bug with zk 7 with auto fill of chrome :(
Auto fill fills the fields in my web page (textbox) but the fields of my view-model or my controller stay empty with chrome.
For example, with an address form autofilled all data is null in my viewmodel (not in my textbox on the webpage)
If I simulate an event 'onChange' my binding works.
(zAu.send(new zk.Event(zk.Widget.$('$idOfMyTextBox'),"onChange",{'value':'test!!','start':6})) )
The problem is the same in a new zk project with one mvvm page.
Does anyone have a solution ?
Thanks for you help :)
Here an example :
<zk >
<window apply="org.zkoss.bind.BindComposer" viewmodel="@id('vm') @init('com.enriquepigeon.TestZk.MyViewModel')">
<label value="Name" />
<textbox value="@bind(vm.nom)" />
<h:br />
<label value="First name" />
<textbox value="@bind(vm.prenom)" />
<h:br />
<label value="Address" />
<textbox value="@bind(vm.adresse)" />
<h:br />
<label value="Postal code" />
<textbox value="@bind(vm.codePostal)" />
<h:br />
<label value="City" />
<textbox value="@bind(vm.ville)" />
<h:br />
<button label="launch" onClick="@command('launch')" />
</window>
</zk>
VM :
public class MyViewModel {
private String nom; private String prenom; private String ville; private String adresse; private String codePostal;
public String getNom() { return nom; }
public void setNom(String nom) { this.nom = nom; }
public String getPrenom() { return prenom; }
public void setPrenom(String prenom) { this.prenom = prenom; }
public String getVille() { return ville; }
public void setVille(String ville) { this.ville = ville; }
public String getAdresse() { return adresse; }
public void setAdresse(String adresse) { this.adresse = adresse; }
public String getCodePostal() { return codePostal; }
public void setCodePostal(String codePostal) { this.codePostal = codePostal; }
@Command public void launch(){ System.out.println("Name : "+nom); System.out.println("First name : "+prenom); System.out.println("Address : "+adresse); System.out.println("Postal code : "+codePostal); System.out.println("City : "+ville); }
}
Result :
And the result is :
Name : MyName First name : null Address : null Postal code : null City : null
maybe you can try to add Notifychange in your method
@Command
@NotifyChange({"nom","prenom","adresse","codePostal","ville"})
public void launch(){
System.out.println("Name : "+nom); System.out.println("First name : "+prenom);
System.out.println("Address : "+adresse); System.out.println("Postal code :
"+codePostal); System.out.println("City : "+ville);
}
Goodluck
Asked: 2015-04-08 04:37:23 +0800
Seen: 51 times
Last updated: Jun 17 '15
my login/index zul page is loading twice, where as i am only calling it once
search button using validation
Databinding and auto-complete on combobox
Multiple selection using ListModelMap<Key, Obj>
Binding ZHIghCharts to server SimpleExtXYModel variable
Notify Form of property change
How to handle lists and complex types with form?
can you create a fiddle where we can test?
chillworld ( 2015-04-08 09:49:42 +0800 )editSorry for the delay, (lot's of work, never end :D)
I will try to do a fiddle, but for waiting i update my question with an example.
kenjiamo ( 2015-04-20 22:31:47 +0800 )edit