field creation based upon data type selected

Hi Everyone,

i am doing a POC, where the requirement is like admin will select Data Type from dropdown in the interface and on click of preview button, one new interface will open that will display selected data type fields of admin interface. for example

 

if Admin will select integer field from the drop down, in next interface  "Integer Type" field will display. once admin will submit the form changes will reflect on next interface which will display to user.

 

Thanks in Advance.

  Discussion posts and replies are publicly visible

Parents
  • Hey vikram,

    I looked into this and I think I understand what you're asking. Here's some boilerplate code that does what you're looking for.

    a!formLayout(
    label: "Boilerplate",
    contents: {
    a!sectionLayout(
    contents: {
    a!dropdownField(
    label: "Dropdown",
    labelPosition: "ABOVE",
    placeholderLabel: "--- Select a Value ---",
    choiceLabels: {"Integer", "Text", "Date"},
    choiceValues: {"Integer", "Text", "Date"},
    value: ri!dataType,
    saveInto: ri!dataType
    )
    }
    ),
    a!sectionLayout(
    contents: {
    a!integerField(
    label: "Integer",
    showWhen: ri!dataType = "Integer"
    ),
    a!textField(
    label: "Text",
    showWhen: ri!dataType = "Text"
    ),
    a!dateField(
    label: "Date",
    showWhen: ri!dataType = "Date"
    )
    }
    )
    }
    )


    When you select any of the choices in the dropdown, the corresponding fields will appear and disappear as necessary.

    Hope this helps!

    Best,
    Ryland
Reply
  • Hey vikram,

    I looked into this and I think I understand what you're asking. Here's some boilerplate code that does what you're looking for.

    a!formLayout(
    label: "Boilerplate",
    contents: {
    a!sectionLayout(
    contents: {
    a!dropdownField(
    label: "Dropdown",
    labelPosition: "ABOVE",
    placeholderLabel: "--- Select a Value ---",
    choiceLabels: {"Integer", "Text", "Date"},
    choiceValues: {"Integer", "Text", "Date"},
    value: ri!dataType,
    saveInto: ri!dataType
    )
    }
    ),
    a!sectionLayout(
    contents: {
    a!integerField(
    label: "Integer",
    showWhen: ri!dataType = "Integer"
    ),
    a!textField(
    label: "Text",
    showWhen: ri!dataType = "Text"
    ),
    a!dateField(
    label: "Date",
    showWhen: ri!dataType = "Date"
    )
    }
    )
    }
    )


    When you select any of the choices in the dropdown, the corresponding fields will appear and disappear as necessary.

    Hope this helps!

    Best,
    Ryland
Children