Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Selected Radio based on Calculated Total

Status
Not open for further replies.

solepixel

Programmer
May 30, 2007
111
US
I have custom calculation script and I want to change a selected radio button based on the value of the calculation. If the calculation is positive, then use selector1, otherwise, use selector2. (selector1 is checked by default)

Code:
var fTotal = this.getField("first_total").value;
var advance = this.getField("advance").value;
var charged = this.getField("charged_atcu").value;
var gTotal = fTotal - advance - charged;
if(gTotal < 0){
    this.getField("selector1").checked = false;
    this.getField("selector2").checked = true;
}
event.value = gTotal;

Can someone explain how to uncheck 1 radio and check another. I don't have any issues with making the radio buttons the same name (to keep them grouped) however, I don't even know how to control these through javascript. Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top