formsif-statementcalculated-columnsorbeon

How to pre-fill the Orbeon text field based on selection on radio button


I am creating an Orbeon form. There is a radio button (control-114) field and a text field (control-111).

I tried the following syntax in the calculated value:

 if($control-114='1') then $control-111='1' else '' 

Solution

  • You were almost there with that expression! In the "Control Settings", "Formulas", "Calculated Value" for control-111 (the text field), you'll want to have:

    if($control-114 = '2') then 'xxx-xxx-xx' else .
    

    Also, in "Read-Only", you should mark the field explicitly as not read-only, with the following, otherwise fields with a "Calculated Value" automatically become read-only.

    false()