How to use JavaScript with Radio Buttons selected to assign a variable a value


hi everyone, kinda new java , trying build form job leave requests.  issue trying assign variable value whether 1 radio button or clicked.  mutually exclusive following information: 

 

name:  radio

tooltip:  choice

button style:  check

radio button choice:  yes (this export value believe though don't quite know how use properly)

 

neither checked default if 1 checked have variable set text "approved" , if other radio button checked set variable contain "disapproved"

 

here code , in advance 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 + " " + supervisor.\n" + "save mail attachment records.\n";

 

this.maildoc({

     bui:  true,

     cto:  ctoaddr,

     ccc:  cccaddr,

     csubject:  csubline,

     cmsg:  cbody

});

 

i want have subject line , body able show approved or disapproved depending on radio button supervisor selects. 

if ( this.getfield("radio").value=="yes") {

     s_auth = "approved";

} else s_auth = "disapproved";

 

i'm home work , have been looking around if knows, work?  i'm going try in morning



More discussions in Acrobat Feature Requests


adobe

Comments

Popular posts from this blog

Embed interactive SWF in PDF - losing interactivity

Falang and too many redirects - Joomla! Forum - community, help and support

Modification to Age Checker Pro module - Joomla! Forum - community, help and support