Error: Binding expression cannot be assigned to

I am loading up a form filled with checkboxes, and I want to dynamically set a checkbox based on the value from the config array that I am getting back from a perl script.

If I use the following code, it correctly sets the checkbox as on or off, but when I try to click on it, I get an error.

html code:

<input type="checkbox" 
name="include_consolidations"
id="include_consolidations"
checked.bind="(sprxInfo.include_consolidations == 'on')">

Error:

Error: Binding expression "sprxInfo.include_consolidations=='on'" cannot be assigned to.

I have tried using value.bind and that does not properly set the checked property on the checkbox.

Is there some feature of bind that I’m missing? I thought I would be able to use an expression in checked.bind.

Thanks in advance.

If you use an expression, it becomes readonly, because it is the result of the evaluation. This goes against the two-way binding nature of checked.bind.
So, you need to bind to a property which can be read and written.
Regards.

1 Like