How to know which button was selected by the end user

Hi All,

Here is a question about interfaces with multiple submit buttons.  I have an approval interface with three submit buttons - Cancel, Re-work, and Proceed.

The user can select any of the buttons to close the form and proceed with the process.  However, I need a way to update a process variable based on which button the user clicked.  Secondly, I would like to make the comment text field required if the user clicks the Cancel or Re-work buttons.

I thought I would add an a!save function in the buttonWidget definitions but it seems SAIL doesn't like that.

How should I do this?

Thanks.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Hi Susan,

    1.
    Typically, you can use an interface rule input of type Text (I usually name it "button_text"), and save the unique value of the button into that variable before submitting.

    For example, clicking the Cancel button should save "Cancel" into ri!button_text. In your process, you should have a button_text process variable that the form saves into.

    "I thought I would add an a!save function in the buttonWidget" - this is possible! :) Make sure you are using the "saveInto" field on the buttonWidget. These saves are executed before the form is submitted.

    2.
    To make a text field required only for certain buttons, it sounds like you might want to look at the "validate" and "submit" fields on each of your buttons - you can alter the logic of whether or not the button should trigger required fields.
Reply
  • 0
    Certified Lead Developer
    Hi Susan,

    1.
    Typically, you can use an interface rule input of type Text (I usually name it "button_text"), and save the unique value of the button into that variable before submitting.

    For example, clicking the Cancel button should save "Cancel" into ri!button_text. In your process, you should have a button_text process variable that the form saves into.

    "I thought I would add an a!save function in the buttonWidget" - this is possible! :) Make sure you are using the "saveInto" field on the buttonWidget. These saves are executed before the form is submitted.

    2.
    To make a text field required only for certain buttons, it sounds like you might want to look at the "validate" and "submit" fields on each of your buttons - you can alter the logic of whether or not the button should trigger required fields.
Children
No Data