Set value in Radiobutton - Javascript
Good morning, I request your support.
I am looking to perform an execution to update a radio button, when the button is clicked the value 1 is marked, when they Reject to send the value 0
->
These are the values that I have configured
Thank you
Regards
-
Use this Javascript method : documentation.agilepoint.com/8000/appbuilder/cloudjsSetFieldValue.html
So you can build a function kind of like this :
function fn_Approve(Approved){
var options = {};
options.fieldId = '[Internal Name of Radio button]';
options.value = ApprovedeFormHelper.setFieldValue(options, function (result)
{
if (result.isSuccess) //check if is success
{
console.log(result.data); //logs the data holds empty object
}
else
{
console.log(result.error); //logs the error
}
});
};Then on your Approve button you set the Javascript function to : fn_Approve(1);
And on your Reject Button : fn_Approve(0); -
On the following line of the Javacript function, if you replace [Internal Name of Radio button] with the proper internal name of your radio button, as soon as you click the buttons, the radio button should change value.
options.fieldId = '[Internal Name of Radio button]';
The "eFormHelper.setFieldValue " method in the function is taking care of changing the radio button value. -
Change the name to the one I'm using
function clickApprove(value){
debugger;
var options = {};
options.fieldId = 'ApproveFlow'; // individual control
options.value = value;
eFormHelper.setFieldValue(options, function (result)
{
if (result.isSuccess) //check if is success
{
console.log(result.data); //logs the data holds empty object
}
else
{
console.log(result.error); //logs the error
}
});
//Se asigna valor Approve(1)/Reject(0)
if(value == "0")
{
debugger;
$("#Return_Reject").prop('disabled', false);
}
else
{
}
}
My html is
<table>\
<tr>\
<td>\
<input id="Approve" class="field Button ButtonOriginal BlueButton"\
style="font-family: Arial; font-size: 12px; font-style: normal; font-weight: normal; text-decoration: none; min-width: 80px;"\
type="button" value="Approve" onclick="clickApprove(1)" ></input>\
</td>\
<td>\
<input id="Reject" class="field Button ButtonOriginal BlueButton"\
style="font-family: Arial; font-size: 12px; font-style: normal; font-weight: normal; text-decoration: none; min-width: 80px;"\
type="button" value="Reject" onclick="clickApprove(0)" ></input>\
</td>\
</tr>\
</table>\
Please sign in to leave a comment.
Comments
6 comments