<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to know which button was selected by the end user</title><link>https://community.appian.com/discussions/f/user-interface/13460/how-to-know-which-button-was-selected-by-the-end-user</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60994?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 16:11:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f54a93b9-609c-4034-9807-1c625457f3b2</guid><dc:creator>susana197</dc:creator><description>Thanks Mike,&lt;br /&gt;
&lt;br /&gt;
This solution worked like a charm!&lt;br /&gt;
&lt;br /&gt;
Have a nice day.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60981?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 14:26:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7c14f0ba-23ae-40da-8672-6c2fc005e721</guid><dc:creator>mitchellg942045</dc:creator><description>As others have stated, if you pass in a pv for the button action as a rule input and save the button text on submit i.e:&lt;br /&gt;
&lt;br /&gt;
a!buttonWidget(&lt;br /&gt;
label: &amp;quot;Cancel&amp;quot;,&lt;br /&gt;
value: &amp;quot;Cancel&amp;quot;,&lt;br /&gt;
saveInto:ri!buttonClicked,&lt;br /&gt;
submit: true&lt;br /&gt;
),&lt;br /&gt;
a!buttonWidget(&lt;br /&gt;
label: &amp;quot;Proceed&amp;quot;,&lt;br /&gt;
value: &amp;quot;Proceed&amp;quot;,&lt;br /&gt;
saveInto:ri!buttonClicked,&lt;br /&gt;
submit: true&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
From there you can have a script task in the process model to update any needed values in the process based on the selected button or throw it right to an XOR gate.  Hope that helps!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60979?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 14:12:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:43b65047-1c60-410b-b5f4-ac7c1a9c47af</guid><dc:creator>charlesm492</dc:creator><description>For the first question, as others have said you just need to use the value and saveInto properties of your buttons to save the different values into a rule inputs.  As a best practice, these values that you are saving should be constants.&lt;br /&gt;
&lt;br /&gt;
For your second question, you would just need to mark the required property of your comment field as true and mark the skipValidation property of your Proceed button as true so that only the other two buttons cause the required validation on the comment field to fire.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60978?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 14:08:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:469c0657-21c9-4913-bc47-d23c992aa2c4</guid><dc:creator>Larry Nguyen</dc:creator><description>I think you can achieve this by having a ri!button (or any rule input variable) and for your buttonWidget saveInto the ri!button.  Have the buttonWidget value field equal to a constant or value that identifies the buttons as the Cancel, Re-Work, or Proceed button.  Map the rule input to the acp and have the acp save into the pv! variable.&lt;br /&gt;
&lt;br /&gt;
For the validation, you can setup a validationGroup for the comment text field and buttonWidgets you want to fire off that validation for that comment text field.  A good example of this is here: &lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://docs.appian.com/suite/help/18.3/recipe_configure_buttons_with_conditional_requiredness.html"&gt;docs.appian.com/.../recipe_configure_buttons_with_conditional_requiredness.html&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60976?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 13:52:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ad64870-7fb7-409b-a881-1017b382f0e5</guid><dc:creator>hrishikeshd997</dc:creator><description>To update a process variable, the interface needs to have rule inputs. Use this rule input into the saveInto attribute in a!buttonWidget.&lt;br /&gt;
eg: &lt;br /&gt;
a!buttonWidget(&lt;br /&gt;
          label: &amp;quot;Cancel&amp;quot;,&lt;br /&gt;
          value: &amp;quot;Cancel&amp;quot;,&lt;br /&gt;
          saveInto:ri!buttonClicked,&lt;br /&gt;
          submit: true&lt;br /&gt;
 ),&lt;br /&gt;
a!buttonWidget(&lt;br /&gt;
          label: &amp;quot;Proceed&amp;quot;,&lt;br /&gt;
          value: &amp;quot;Proceed&amp;quot;,&lt;br /&gt;
          saveInto:ri!buttonClicked,&lt;br /&gt;
          submit: true&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
This will mean if Cancel is clicked ri!buttonClicked will have value as &amp;quot;Cancel&amp;quot;, if proceed button is clicked it will have value as &amp;quot;Proceed&amp;quot;.&lt;br /&gt;
Then map this to a process variable in the Data -&amp;gt; Inputs tab in a User Input Task activity in which your SAIL interface is called. The rule inputs of the interface will be the activity class parameters (Data Inputs) and these can be mapped to a process variable.&lt;br /&gt;
&lt;br /&gt;
For your second query you can use validation groups. Refer to this SAIL recipe - &lt;a href="https://docs.appian.com/suite/help/18.3/recipe_configure_buttons_with_conditional_requiredness.html"&gt;docs.appian.com/.../recipe_configure_buttons_with_conditional_requiredness.html&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60975?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 13:49:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ac7fa00c-c12b-4b95-998b-dc7cf354dfbb</guid><dc:creator>Andrew Zysk</dc:creator><description>Hi Susan,&lt;br /&gt;
&lt;br /&gt;
1.&lt;br /&gt;
Typically, you can use an interface rule input of type Text (I usually name it &amp;quot;button_text&amp;quot;), and save the unique value of the button into that variable before submitting.&lt;br /&gt;
&lt;br /&gt;
For example, clicking the Cancel button should save &amp;quot;Cancel&amp;quot; into ri!button_text. In your process, you should have a button_text process variable that the form saves into.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;I thought I would add an a!save function in the buttonWidget&amp;quot; - this is possible! :) Make sure you are using the &amp;quot;saveInto&amp;quot; field on the buttonWidget. These saves are executed before the form is submitted.&lt;br /&gt;
&lt;br /&gt;
2.&lt;br /&gt;
To make a text field required only for certain buttons, it sounds like you might want to look at the &amp;quot;validate&amp;quot; and &amp;quot;submit&amp;quot; fields on each of your buttons - you can alter the logic of whether or not the button should trigger required fields.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60973?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 13:41:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cacad879-f1ac-4420-ba0c-8bede351612b</guid><dc:creator>Carlos Santander</dc:creator><description>For the first question, you need give a different value to each button, and then have each button save into the same rule input.&lt;br /&gt;
&lt;br /&gt;
For the second question, you can make use of validation groups. Take a look at the following recipe for an example: &lt;a href="https://docs.appian.com/suite/help/18.3/recipe_configure_buttons_with_conditional_requiredness.html"&gt;docs.appian.com/.../recipe_configure_buttons_with_conditional_requiredness.html&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60972?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 13:41:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c2dc9660-1d26-4118-b43b-9f3e256e3733</guid><dc:creator>gianninol</dc:creator><description>It should be perfectly possible to add an a!save function in the saveInto field of the buttonWidget. Can you be more specific when you say that SAIL doesn&amp;#39;t like it? &lt;br /&gt;
&lt;br /&gt;
As for making it required only when those specific buttons are pressed, you can make use of the validationGroup parameter on the buttons and the field. Link to example here: &lt;a href="https://docs.appian.com/suite/help/18.3/recipe_use_validation_group_for_buttons_with_multiple_validation_rules.html"&gt;docs.appian.com/.../recipe_use_validation_group_for_buttons_with_multiple_validation_rules.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I believe you can add multiple validation groups to the field by having a space between each validation group you want it to belong to.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which button was selected by the end user</title><link>https://community.appian.com/thread/60971?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 13:40:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f44bfcd7-0122-41e0-a274-841335bd1248</guid><dc:creator>Mike Lasutschinkow</dc:creator><description>&lt;p&gt;Yes, you can add a save into the saveInto of the button (and this is the most sensible way to capture which button was pressed).&lt;/p&gt;
&lt;p&gt;Your code would look something like the following:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!buttonWidgetASubmit(
    label: cons!BUTTON_LABEL_TEXT, /* your constants here */
    value: cons!BUTTON_LABEL_TEXT,
    saveInto: {
        ri!buttonClicked /* text rule input to save into process variable */
    }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>