Interface getting reload when I select a value from dropdown

Certified Associate Developer

Hi there,

I have created two interface which are MedicalRequestForm and EquipmentRequestForm, then I created third interface as RequestForm where I took a radio button and shown the value as RequesType (Medical and Equipment).

I want that MedicalRequestForm or EquipmentRequestForm must be shown on the basis of radio button selection which is working. But In my first both interfaces, I have one dropdown, so whenever I am selecting a value from the dropdown, then whole Interface (RequestForm) is getting reload/refresh.

Note: I took the rule input as ZMS_Requests in all the interfaces separately.

Please see the below screenshots:

1. MedicalRequestForm:

2. EquipmentRequestForm:

3. RequestForm (without selection):

4. RequestForm (with selection of Medical):

5. RequestForm is getting back as screenshot no.3 when I select a value from dropdown Animal Name as above screenshot.

Could anyone of you help me to resolve this issue?

Please let me know if you need code.

Thank you in advance!

Regards,

Shubham Kumar

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to Shubham Kumar

    Hi Shubham, you can make the rule inputs null in saveInto parameter based on raidio button selection. SOme thing like below,

    saveInto:{

    if(

    ri!ZMS_Requests.requesttype="Equipment",

    {

    a!save(ri!input1,null),

    a!save(ri!input2, null)

    }

    you can make any field null based on your requirements.

  • 0
    Certified Associate Developer
    in reply to GopalK

    Thanks for your response!

    I am getting confused. Pasted my code below, could you please help where I do?

    a!localVariables(
      local!reqTypes: cons!ZMS_REQUEST_TYPES,
      a!formLayout(
        label: "Raise A Request",
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(contents: {}),
              a!columnLayout(
                contents: {
                  a!radioButtonField(
                    label: "Request Type",
                    labelPosition: "ABOVE",
                    choiceLabels: local!reqTypes,
                    choiceValues: local!reqTypes,
                    value: ri!ZMS_Requests.requesttype,
                    saveInto: ri!ZMS_Requests.requesttype,
                    required: true,
                    requiredMessage: "please select request type",
                    choiceLayout: "COMPACT",
                    choiceStyle: "STANDARD",
                    validations: {}
                  )
                }
              ),
              a!columnLayout(contents: {})
            }
          ),
          a!boxLayout(
            label: "Medical Request",
            contents: rule!ZMS_MedicalRequestForm(ZMS_Requests: ri!ZMS_Requests),
            showWhen: if(
              ri!ZMS_Requests.requesttype = local!reqTypes[1],
              true,
              false
            ),
            style: "SUCCESS",
            shape: "ROUNDED",
            marginBelow: "STANDARD"
          ),
          a!boxLayout(
            label: "Equipment Request",
            contents: rule!ZMS_EquipmentRequestForm(ZMS_Requests: ri!ZMS_Requests),
            showWhen: if(
              ri!ZMS_Requests.requesttype = local!reqTypes[2],
              true,
              false
            ),
            style: "SUCCESS",
            shape: "ROUNDED",
            marginBelow: "STANDARD"
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              submit: true,
              saveInto: {
                a!save(
                  ri!ZMS_Requests.createdby,
                  loggedInUser()
                ),
                a!save(
                  ri!ZMS_Requests.requestorname,
                  loggedInUser()
                ),
                a!save(ri!ZMS_Requests.createddate, now()),
                a!save(ri!ZMS_Requests.isactive, true),
                a!save(ri!ZMS_Requests.isapproved, false),
                a!save(ri!ZMS_Requests.approvalrequired, false),
                a!save(ri!ZMS_Requests.overbudget, false),
                a!save(
                  ri!ZMS_Requests.requestname,
                  cons!ZMS_REQUEST_STATUS[1]
                )
              },
              style: "PRIMARY"
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancel",
              value: true,
              saveInto: ri!cancel,
              submit: true,
              style: "NORMAL",
              validate: false
            )
          }
        )
      )
    )

  • +1
    Certified Senior Developer
    in reply to Shubham Kumar

    Hi Shubham, Lets say you want to refresh the value for field "animalName", then your code would be like below,

    a!radioButtonField(
                    label: "Request Type",
                    labelPosition: "ABOVE",
                    choiceLabels: local!reqTypes,
                    choiceValues: local!reqTypes,
                    value: ri!ZMS_Requests.requesttype,
                    saveInto: {
                    ri!ZMS_Requests.requesttype,
                    if(
                     ri!ZMS_Requests.requesttype="Equipment",
                      {
                       a!save(ri!ZMS_Requests.animalName,null)
                       },
                        {}
                      )
                    }
                    required: true,
                    requiredMessage: "please select request type",
                    choiceLayout: "COMPACT",
                    choiceStyle: "STANDARD",
                    validations: {}
                  )

    In the same way you can make null other fields as well when user changes value from "animal" to "Equipment"

  • 0
    Certified Associate Developer
    in reply to GopalK

    Thanks a lot alot alot alot ... Slight smile