Call a form when user selects a drop down value

Hi all, 

I have an interface where I've configured a drop down field. Upon selecting the drop down values different forms should load in the same section respectively. Please suggest how can I call interface 2 upon selecting a drop down value in interface 1 ? Thanks in advance. 

for ex I have a drop down field in below interface 1:

=load(
local!TicketTypes: cons!SAFETY_TEXT_REQUEST_TYPES, 

local!selectedTicketType,

with(
a!sectionLayout(
label: upper(
"details"
),
contents:
a!boxLayout(
label: "Ticket Related Information",
style: "ACCENT",
contents: {
a!dropdownField(
label: "Ticket Type",
instructions: "Value saved: " & local!selectedTicketType,
placeholderLabel: "--- Select Ticket Type ---",
choiceLabels: local!TicketTypes, 
choiceValues: local!TicketTypes,
value: ri!SAFETY_cases.case_type,
saveInto: {
ri!SAFETY_cases.case_type,

}),

Now I have to call below interface 2 in interface 1 when user selects first drop down value:

a!sectionLayout(
label: upper(
"company information"
),
contents:
a!columnsLayout(
columns: {
a!columnLayout(
contents: {

a!textField(
label: "Client Name",
labelPositon: "ABOVE",
instructions: "",
placeholder: "- - - Enter Client Name - - -",
value: ri!SAFETY_CASES.client_name,
saveInto: "",
required: true,
validations: "",

),

a!checkboxField(
label: "Type of Request",
instructions: "",
required: true,
choiceLabels: {
"New Request",
"Update Exisiting Instructions",
"Delete Request"
},
choiceValues: {
"New Request",
"Update Exisiting Instructions",
"Delete Request"
},
value: ri!SAFETY_CASES.request_type,
saveInto: "",
choiceLayout: "STACKED",

)
}
),
/*EXTRA SPACE*/
a!columnLayout(
content: {},
width: "NARROW",

),
a!columnLayout(
contents: {

a!textField(
label: "Account Number",
labelPosition: "ABOVE",
instructions: "",
placeholder: "- - - Enter Account Number - - -",
value: ri!SAFETY_CASES.account_number,
saveInto: "",
required: true,
validations: {},

),

}
)
}
))

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You can save the section or portion of the form you want to display in a separate interface rule, and then call that rule inside your larger SAIL that also has the dropdown.

    Now, for the display of that rule, you set the showWhen: parameter of the section to an if() statement that evaluates true when the dropdown variables are configured such that you want to display it.  You pass the variable from the dropdown into the rule so it can determine if showWhen is true or false

    Now, do the same thing again, only a different separate interface rule, and a different set of conditions that make the different one appear or disappear.

    If the conditions are based on one dropdown value or the other, they should never both display at the same time.  If you need to, you can make it so that in the right circumstances they do.  Going forward this way you'll most likely have neither one appears until you select something from the dropdown, but you could set up one to show by default unless the other one should appear.

  • Thank you so much for the response . I am just a little confused here. So do I have to use the If() condition in the SaveInto parameter of the dropdown field in my main field as below? where exacty should I use show when condition?

    =load(
    local!TicketTypes: cons!SAFETY_TEXT_REQUEST_TYPES,
    with(
    a!sectionLayout(
    label: upper(
    "details"
    ),
    contents:
    a!boxLayout(
    label: "",
    contents:
    a!columnsLayout(
    columns:
    a!columnLayout(
    contents:
    a!dropdownField(
    label: "Ticket Type",
    placeholderLabel: "--- Select Ticket Type ---",
    choiceLabels: local!TicketTypes,
    choiceValues: local!TicketTypes,
    value: ri!SAFETY_cases.case_type,
    saveInto:ri!SAFETY_cases.case_type,
    ),

    if(
    ri!SAFETY_cases.case_type = cons!SAFETY_TEXT_REQUEST_TYPES[1],
    rule!SAFETY_SECTION_RULE(
    ri!SAFETY_cases, true
    ),
    true,
    false)



    ))))))

Reply
  • Thank you so much for the response . I am just a little confused here. So do I have to use the If() condition in the SaveInto parameter of the dropdown field in my main field as below? where exacty should I use show when condition?

    =load(
    local!TicketTypes: cons!SAFETY_TEXT_REQUEST_TYPES,
    with(
    a!sectionLayout(
    label: upper(
    "details"
    ),
    contents:
    a!boxLayout(
    label: "",
    contents:
    a!columnsLayout(
    columns:
    a!columnLayout(
    contents:
    a!dropdownField(
    label: "Ticket Type",
    placeholderLabel: "--- Select Ticket Type ---",
    choiceLabels: local!TicketTypes,
    choiceValues: local!TicketTypes,
    value: ri!SAFETY_cases.case_type,
    saveInto:ri!SAFETY_cases.case_type,
    ),

    if(
    ri!SAFETY_cases.case_type = cons!SAFETY_TEXT_REQUEST_TYPES[1],
    rule!SAFETY_SECTION_RULE(
    ri!SAFETY_cases, true
    ),
    true,
    false)



    ))))))

Children
  • Hey Meena - Please try the below code and let me know if it helps achieve your required use case.

    = load(
      local!TicketTypes: {
        "Ticket A",
        "Ticket B"
      }/*cons!SAFETY_TEXT_REQUEST_TYPES*/,
      local!ticketValue/*ri!SAFETY_cases.case_type*/,
      local!clientName/*ri!SAFETY_CASES.client_name*/,
      local!requestType/*ri!SAFETY_CASES.request_type*/,
      local!acntNum/*ri!SAFETY_CASES.account_number*/,
      local!selectedTicketType,
      with(
        {
          a!sectionLayout(
            label: upper(
              "details"
            ),
            contents: a!boxLayout(
              label: "Ticket Related Information",
              style: "ACCENT",
              contents: {
                a!dropdownField(
                  label: "Ticket Type",
                  instructions: "Value saved: " & local!selectedTicketType,
                  placeholderLabel: "--- Select Ticket Type ---",
                  choiceLabels: local!TicketTypes,
                  choiceValues: local!TicketTypes,
                  value: local!ticketValue,
                  saveInto: {
                    local!ticketValue
                  }
                )
              }
            )
          ),
    
            a!sectionLayout(
              label: upper(
                "company information"
              ),
              showWhen: local!ticketValue = "Ticket A"/*cons!SAFETY_TEXT_REQUEST_TYPES[1]*/,
              contents: a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Client Name",
                        labelPositon: "ABOVE",
                        instructions: "",
                        placeholder: "- - - Enter Client Name - - -",
                        value: local!clientName,
                        saveInto: local!clientName,
                        required: true,
                        validations: "",
                        
                      ),
                      a!checkboxField(
                        label: "Type of Request",
                        instructions: "",
                        required: true,
                        choiceLabels: {
                          "New Request",
                          "Update Exisiting Instructions",
                          "Delete Request"
                        },
                        choiceValues: {
                          "New Request",
                          "Update Exisiting Instructions",
                          "Delete Request"
                        },
                        value: local!requestType,
                        saveInto: local!requestType,
                        choiceLayout: "STACKED",
                        
                      )
                    }
                  ),
                  /*EXTRA SPACE*/
                  a!columnLayout(
                    content: {},
                    width: "NARROW",
                    
                  ),
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Account Number",
                        labelPosition: "ABOVE",
                        instructions: "",
                        placeholder: "- - - Enter Account Number - - -",
                        value: local!acntNum,
                        saveInto: local!acntNum,
                        required: true,
                        validations: {},
                        
                      )
                    }
                  )
                }
              )
            )
            
        }
      )
    )

  • Thank you so much for the response @Siddharth In your code, instead of calling a section with ShowWhen condition, I want to call a rule(Interface that has multiple sections) let's say rule!InterfaceWithMultipleSections. How can I pass this rule in my main form?

  • You can directly pass your desired rule (containing the interface with multiple sections) in place of the section with the showWhen condition. You can control the display of the various sections in the interface using the showWhen parameter of a!sectionLayout.

    = load(
      local!TicketTypes: {
        "Ticket A",
        "Ticket B"
      }/*cons!SAFETY_TEXT_REQUEST_TYPES*/,
      local!ticketValue/*ri!SAFETY_cases.case_type*/,
      local!clientName/*ri!SAFETY_CASES.client_name*/,
      local!requestType/*ri!SAFETY_CASES.request_type*/,
      local!acntNum/*ri!SAFETY_CASES.account_number*/,
      local!selectedTicketType,
      with(
        {
          a!sectionLayout(
            label: upper(
              "details"
            ),
            contents: a!boxLayout(
              label: "Ticket Related Information",
              style: "ACCENT",
              contents: {
                a!dropdownField(
                  label: "Ticket Type",
                  instructions: "Value saved: " & local!selectedTicketType,
                  placeholderLabel: "--- Select Ticket Type ---",
                  choiceLabels: local!TicketTypes,
                  choiceValues: local!TicketTypes,
                  value: local!ticketValue,
                  saveInto: {
                    local!ticketValue
                  }
                )
              }
            )
          ),
          rule!InterfaceWithMultipleSections()/* You can pass the local!ticketValue as a rule input to the above rule to 
          control conditional display of the various sections using the showWhen parameter of a!sectionLayout*/
          
        }
      )
    )