Versions Compared

Key

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

This is a quick demo on how you can reuse you ConfiForms configurations by creating user macros


Consider the following form, where the user can choose an option and if an "other" option is selected then the text field is shown to capture the value for the "other"

Image Added


What we can do is to take out the 3 macros that define the fields and their behaviour and create a user macro that can be reused whenever needed

We take out the storage format for these 3 macro and create a "cf-choices" macro like this


Image Added


Code Block
    <p>
      <ac:structured-macro ac:macro-id="574fb50b-f05d-4fd6-bbaf-941028cdd456" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">choices</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Choices</ac:parameter>
        <ac:parameter ac:name="values">false[1=one|2=two|3=three|4=other|]</ac:parameter>
        <ac:parameter ac:name="type">select</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="b355cde9-2e2c-4ffe-8c16-9d7a14c05c0e" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">!choices:4</ac:parameter>
        <ac:parameter ac:name="fieldName">otherChoice</ac:parameter>
        <ac:parameter ac:name="action">Hide field</ac:parameter>
        <ac:parameter ac:name="actionFieldName">choices</ac:parameter>
        <ac:parameter ac:name="withReverseRule">true</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="17ef6a3a-7550-402a-abb4-a6d8146ef8d3" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">otherChoice</ac:parameter>
        <ac:parameter ac:name="fieldLabel">What is you choice?</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>



So, in the end the macro configuration for the user looks like this


Image Added


See the online demo below


true
ConfiForms Form Definition
formNamemyform
ConfiForms Form Definition
formNamemyform
ConfiForms (FormView) Registrations Control
formNamemyform
embeddedmyformtrueINLINE