0

Conditionally prevent properties from binding

asked 2017-06-23 06:01:45 +0800

JustinFrost gravatar image JustinFrost
139 1 6

updated 2017-06-23 06:03:17 +0800

Hi

We are using form binding on a UI component as follows:

 <panelform disabled="@load(vm.system)"
    form="@id('formData') @load(vm.employee) @save(vm.employee, before='doSaveEmployee')">
        <textbox id="employeeName" value="@load(formData.name)" disabled="@load(formData.manager)"/>
    </panelform>

The set disabled on the panelform component loops through all of the child components and calls setDisabled(false). This successfully disables the components in this example the employeeName textBox is disabled because vm.system is true.

The problem is when the employeeName disabled property @load is performed, the field is enabled as formData.manager is false.

Is there anyway to override the binder with a custom class and ignore the disabled property bindings under certain conditions. In this example when the vm.system = true we want to ignore individual disabled property bindings on the components in the panelform.

Thanks.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-06-23 10:15:54 +0800

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

And like this?

disabled="@load(vm.prop?formData.manager:'')"
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: 2017-06-23 06:01:45 +0800

Seen: 13 times

Last updated: Jun 23 '17

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