xxforms:valid

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

xxforms:valid

blabla
Hi all, I am having problem with the xxforms:valid. i am trying to set the enable/disable the button by using the readonly attribute in the xforms:bind using this line :

<xforms:bind nodeset="instance('button-instance')/validation" readonly="xxforms:valid(instance('application-instance'), true())"/>

i am able to enable the button. but as i have some mandatory field and some year field which i have set the constraint for the year field using xforms:bind.

<xforms:bind nodeset="english_proficiency/toefl_year" constraint="if (string-length(.) &lt; 1  ) then true() else . castable as xs:integer and string-length(.) = 4 "/>

which will only accept if the data is a 4 digit number.

the problem i have is that after i enter the data into the mandatory field, the button enabled but when i delete the data on mandatory field or i insert invalid year, it wont disable the button.

it seem the xxforms:valid will not detect the sub nodes.

<xforms:bind nodeset="instance('button-instance')/validation" readonly="xxforms:valid(instance('application-instance')/english_proficiency, true())"/>

works for the year but it wont check for the mandatory field.
Reply | Threaded
Open this post in threaded view
|

Re: xxforms:valid

Alessandro  Vernet
Administrator
Hi Chris,

I am not sure if this is what you're seeing, but one problem with this approach is that the button will only change state (enabled to disabled / disabled to enabled) when users leave a field. So, say "year" field is required. At first, the button will be disabled. Users enter a value in the year field, an try to click on the button: this won't work as until the focus goes to another XForms field, the button won't become enabled. So if you really need to have the button disabled when the data isn't valid, I recommend you add incremental="true" on the year's <xf:input>, and on any other input on your form that might be invalid.

If despite that it doesn't work for you, could you create a minimal example that reproduces the issue, and provide steps to reproduce the issue with that example, so we can run it here?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xxforms:valid

blabla
It works, thanks alot