Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Sets price of 10 if choice 1 or choice 2 is selected and sets price to 15 if both choices are selected

ConfiForms Form Definition
formNamef
trueINLINE


choiceChoicefalse[1=one|2=two|]checkbox_grouptrue

pricePrice0read_only

(choice:1 AND !choice:2) OR (choice:2 AND !choice:1trueprice=10Set valuetruechoice

choice:1 AND choice:2trueprice=15Set valuetruechoice

choice:[empty]price=0Set valuechoice


code for the demo

Code Block
<ac:structured-macro ac:macro-id="e00876ca-2089-48b4-bb4d-6abbbe0ca18b" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="f8403416-81bf-4da6-a323-33e3cc6322fb" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:parameter ac:name="embedded">true</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="8bbeb712-829a-4b44-94fc-b9de20aee34c" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">choice</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Choice</ac:parameter>
        <ac:parameter ac:name="values">false[1=one|2=two|]</ac:parameter>
        <ac:parameter ac:name="type">checkbox_group</ac:parameter>
        <ac:parameter ac:name="required">true</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="98043a2f-46f2-4d92-8638-d37b4696a441" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">price</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Price</ac:parameter>
        <ac:parameter ac:name="values">0</ac:parameter>
        <ac:parameter ac:name="type">read_only</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="52bc63bb-ec86-47a1-8ba7-dd09a50d06ad" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">(choice:1 AND !choice:2) OR (choice:2 AND !choice:1</ac:parameter>
        <ac:parameter ac:name="noPropagation">true</ac:parameter>
        <ac:parameter ac:name="values">price=10</ac:parameter>
        <ac:parameter ac:name="action">Set value</ac:parameter>
        <ac:parameter ac:name="onUserActionOnly">true</ac:parameter>
        <ac:parameter ac:name="actionFieldName">choice</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="d6d21543-f4b0-4760-9719-0458f24f3dbc" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">choice:1 AND choice:2</ac:parameter>
        <ac:parameter ac:name="noPropagation">true</ac:parameter>
        <ac:parameter ac:name="values">price=15</ac:parameter>
        <ac:parameter ac:name="action">Set value</ac:parameter>
        <ac:parameter ac:name="onUserActionOnly">true</ac:parameter>
        <ac:parameter ac:name="actionFieldName">choice</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="91eaa4ba-981c-47b1-9514-01fca4cbbbd0" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">choice:[empty]</ac:parameter>
        <ac:parameter ac:name="values">price=0</ac:parameter>
        <ac:parameter ac:name="action">Set value</ac:parameter>
        <ac:parameter ac:name="actionFieldName">choice</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>