Setting to null values for controls where visibility is false

29 views
Skip to first unread message

Seth

unread,
Feb 17, 2020, 7:01:16 PM2/17/20
to orb...@googlegroups.com
I am building form where controls are conditionally visible. My need is to
remove a stored value if the user modifies the parent control and makes a
control containing data no longer visible. ex.

control 1 age "Is person over the age of 18" Yes = 1, No = 0;

control 2 guardian visible if $age = 1 guardian "Are you the
parent/guardian?"

The need is that if the user first selects "No" for control age then
provides data in control guardian. Next the user changes the selection of
control age to "Yes" I need the value of the control guardian which is no
longer visible set to ''


--
Sent from: http://discuss.orbeon.com/

Alessandro Vernet

unread,
Feb 18, 2020, 6:23:58 PM2/18/20
to orb...@googlegroups.com
Hi Seth,

Yes, this would be very useful, and we do have request for enhancement #3152
for this (see link below). I've added a +1 from you!

https://github.com/orbeon/orbeon-forms/issues/3152

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Jarosław Kowalewski

unread,
Feb 18, 2020, 6:33:55 PM2/18/20
to orb...@googlegroups.com
Hi,
I met such a case 12 years ago and till now have to work with it.
Maybe it would be nice to have any 'form builder' checkbox but you can fix it now just by using 'simple' XPath expression. 
just in calculated field type something like:
if($myfiled = '1') then . else ''  ('' single quotes means empty string/value)
what will calculated as: if a field is visible ( $myfiled = '1' ) just accept what user typed, otherwise reset to empty value. 
And that's it :) 

//Jarek

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1582068245901-0.post%40n4.nabble.com.
Message has been deleted

Alessandro Vernet

unread,
Feb 19, 2020, 6:18:52 PM2/19/20
to orb...@googlegroups.com
Hi Seth, I'm not sure if you intended to add something in your previous
message, but only the quoted content of Jarek's message came back in your
answer.

Seth Parkhurst

unread,
Feb 19, 2020, 6:22:36 PM2/19/20
to Orbeon Forms
Hi Jarek and Alessandro,

Thank both of you for the quick and helpful responses.  I am using a multiselect option for the parent so the = option will not work unless I use a large matrix of all possible solutions containing the value(s) I need for the visibility.  I used this XPath for the visibility:

$MyField[contains(text(), '1')] or $MyField[contains(text(), '2')] or $MyField[contains(text(), '3')]

But I am not able to use the same formula in the calculated value?  I may not have the proper syntax. The second issue that is related is getting the formula to work with a dynamic dropdown.  When I have a formula like:

if($MyField[contains(text(), '1')]) then . else if($MyField[contains(text(), '2')]) then . else'' 

Then the dropdown becomes read only and the user cannot modify the dropdown.

I have tried many combinations but not one that has been a legal syntax or produced the results I am aiming to achieve.  Any thoughts?


On Tuesday, February 18, 2020 at 5:33:55 PM UTC-6, Jarek wrote:
Hi,
I met such a case 12 years ago and till now have to work with it.
Maybe it would be nice to have any 'form builder' checkbox but you can fix it now just by using 'simple' XPath expression. 
just in calculated field type something like:
if($myfiled = '1') then . else ''  ('' single quotes means empty string/value)
what will calculated as: if a field is visible ( $myfiled = '1' ) just accept what user typed, otherwise reset to empty value. 
And that's it :) 

//Jarek

śr., 19 lut 2020 o 00:23 Alessandro Vernet <ave...@orbeon.com> napisał(a):
Hi Seth,

Yes, this would be very useful, and we do have request for enhancement #3152
for this (see link below). I've added a +1 from you!

https://github.com/orbeon/orbeon-forms/issues/3152

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orb...@googlegroups.com.

Jarosław Kowalewski

unread,
Feb 20, 2020, 5:19:42 AM2/20/20
to orb...@googlegroups.com
Hi,
1. You can use the same formula in calculate as in visibility. 
2. Ok i forgot to add you need to explicitly mark field as readonly false() as Form Runner makes calculated fields readonly by default. Not sure what version you use but in 2018.2.1 (bug solved in the newer versions) you have to use dummy formula in readonly field like 1=2.

//Jarek


To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/f0ac4342-ff2b-4218-adea-04748708cb2d%40googlegroups.com.

Seth Parkhurst

unread,
Feb 20, 2020, 11:44:26 AM2/20/20
to Orbeon Forms
This works perfectly thank you!


On Thursday, February 20, 2020 at 4:19:42 AM UTC-6, Jarek wrote:
Hi,
1. You can use the same formula in calculate as in visibility. 
2. Ok i forgot to add you need to explicitly mark field as readonly false() as Form Runner makes calculated fields readonly by default. Not sure what version you use but in 2018.2.1 (bug solved in the newer versions) you have to use dummy formula in readonly field like 1=2.

//Jarek


Reply all
Reply to author
Forward
0 new messages