How to display a different (new) section on click of SUBMIT button?

Hi,

I have a editable grid where the user can edit the data on the grid and on click of submit button, data will be saved in DB. Am using writetodatastore entity smart service onclick of submit button. OnSuccess I need to hide the editable grid and display a section with the corresponding message. I tried below code and some thing else also but no luck,

a!buttonLayout(
          primaryButtons: {
            a!buttonWidgetSubmit(
              label: "Submit",
              saveInto: {
                a!writeToDataStoreEntity(
                  dataStoreEntity: cons!DS_ENTITY_REF_EMPLOYEE,
                  valueToStore: local!questionsToUpdate.data,
                  onSuccess: {
                    with(a!richTextDisplayField(
                      label: "Employee's Updated Successfully",
                      align: "CENTER",
                      style: "STRONG"
                    ))
                  },
                  onError: {
                   
                   
                  }
                ),
                local!currentStep
              },
              style: "NORMAL"
            )
          },
          secondaryButtons: {
            a!buttonWidgetSubmit(
              label: "Cancel",
              value: true,
              saveInto: ri!cancel,
              style: "LINK",
              skipValidation: true
            )
          }
        )

Thanks.

Regards,

Balaji.R

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    the onSuccess parameter is used for a list of saves or an HTTP response to execute after the smart service executes successfully.
    So, what you can do is update a local variable at onSuccess using a!save.
    Use that local variable in the showWhen condition of your grid Layout.
    Also, use your code,
    a!richTextDisplayField(
    label: "Employee's Updated Successfully",
    align: "CENTER",
    style: "STRONG"
    )
    in the contents field of your formLayout, or immediately after your grid Layout ends and use the same local variable as mentioned above in the showWhen parameter to show the section onSuccess.

    Also, your submit button should be a!buttonWidget(). You can replace the label as "Write".

    And you can show your actual "submit" button which uses a!buttonWidgetSubmit() after you display the message.

  • 0
    A Score Level 1
    in reply to Aditya
    Hi AdityaU ,

    Thanks for the detailed response, i tried the same way you mentioned and it worked. Thanks :)

    Regards,
    Balaji.R
Reply Children
No Data