0

How retrieve old value for dirty fields

asked 2024-01-18 07:11:59 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

updated 2024-01-23 09:27:23 +0800

hawk gravatar image hawk
3205 1 5
http://hawkphoenix.blogsp... ZK Team

Hi,

I use Simple Form to retrieve old value from a form field to check some condition. I used, some years ago, ZK Ver.6. I tried to start new project with ZK 9.6.0.1 to test some idea... with a little bit of problems. Retrieve old value from SimpleForm is fundamental for me. Any idea? Thanks Luca

Form:

<div form="@id('gbD') @init(vm.myForm) @load(vm.selected) @save(vm.selected, before='save')"
id="formGroup" visible="@load(not empty vm.selected)" hflex="true"
mold="3d" validationMessages="@id('vmsgs')" contentStyle="border: none">
<grid hflex="true">
<columns>
    <column label="Campo" width="150px" />
    <column label="Contenuto" />
</columns>
<rows>
    <row>
    Operatore
    <hbox>
    Tipo
    <hbox>
    <radiogroup id="chkTipoUtente" selectedItem="@bind(gbD.tipo_operatore)">
    <radio label="Amministratore" value="A" />
    <radio label="Utente" value="U" />
    <radio label="Segreteria" value="S" />
    </radiogroup>
    </hbox>
    </row>

Controller:

if(myForm.getField("tipo_operatore").equals("A") && 
selected.GetTipo_operatore().equalsIgnoreCase("U")
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-01-23 16:25:21 +0800

hawk gravatar image hawk
3205 1 5
http://hawkphoenix.blogsp... ZK Team

Since ZK 9.5.0, zk doesn't create SimpleForm by default. It creates a proxy object upon your target object, for example, if vm.selected is a Book, it creates a proxy object for Book, you can cast the proxy object to Book and use it as a Book.

Please read "Accessing a FormProxyObject" at https://books.zkoss.org/zk-mvvm-book/10.0/databinding/formbinding.html

Check examples below: * https://github.com/zkoss/zkbooks/blob/master/mvvmreference/src/main/webapp/databinding/form/formProxy.zul * https://github.com/zkoss/zkbooks/blob/master/mvvmreference/src/main/java/org/zkoss/mvvm/databinding/form/BooksViewModel.java

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

RSS

Stats

Asked: 2024-01-18 07:11:59 +0800

Seen: 4 times

Last updated: Jan 23

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