How to use JavaScript with Radio Buttons selected to assign a variable a value
Hi everyone, kinda new to Java and trying to build a form for my job for leave requests. My issue is that I am trying to assign a variable a value whether one radio button or another is clicked. Currently they are mutually exclusive with the following information:
Name: Radio
Tooltip: Choice
Button Style: Check
Radio Button Choice: Yes (this is the export value I believe though I don't quite know how to use it properly)
neither are checked by default but if one is checked I would like to have a variable set to the text "Approved" and if the other radio button is checked I would like to set the variable to contain "Disapproved"
Here is my code currently and thanks in advance for the help to all:
var S_auth;
function auth() {
if (Radio.value == "Yes") {
var S_auth = "Approved";
}
else {
var S_auth = "Disapproved";
}
}
var Employee = this.getField("Emp_Name").value;
var Supervisor = this.getField("Supervisor").value;
var Leave_Type = this.getField("Dropdown2").value;
var cToAddr = name@emailaddy.com;
var cCCADDr = this.getField("Email").value;
var cBenAddr = this.getField("Sup_Email").value; if (cBenAddr != "") cCCADDr += ";" + cBenAddr;
var cSubline = "Re: Leave request form for" + " " + Employee + ", " + Leave_Type + ", Status: " + S_auth;
var cBody = "Your leave request has been " + S_auth + " by " + Supervisor.\n" + "Save mail attachment for your records.\n";
this.mailDoc({
bUI: true,
cTo: cToAddr,
cCc: cCCAddr,
cSubject: cSubLine,
cMsg: cBody
});
I honestly just want to have the subject line and body to be able to show approved or disapproved depending on which radio button the supervisor selects.
