Can calculate function be performed on an editable control as well
I am using the calculate attribute for a particular node which is editable to get a default value initially. When the control loads initially the default value is getting populated depending upon the calculate attribute f开发者_高级运维or that particular node. But when i override the default value, the overridden value is not getting binded to that node. Is there any solution for this problem ?
Yes, you can allow users to edit the value of a node for which you have a calculate. For this, in the xforms:bind
, explicitly add readonly="false()"
, as a node for which you specify a calculate
automatically becomes readonly. If you do this, keep in mind that the calculate
also runs after users edited the field, so that expression needs to be written in such a way that it doesn't overwrite the value entered by users. Often you would do something like: calculate="if (. = '') then {some expression} else ."
, not to overwrite what users typed if they did type something.
精彩评论