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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a fields value to '0' if checked otherwise adding its content 1

Status
Not open for further replies.

Olorin1

Technical User
Feb 14, 2001
17
CA
This is what i mean: (two problems)

First - I have a spreadsheet type form which ultimately adds the GST (tax canadian style)to the total. But i need to add a checkbox which if clicked will render the tax field as '0' - hence not adding tax. What can you recommend for the function where the tax is otherwise being calculated all the time.

Something like (which obviously isn't working)

if {
form.checkbox.value = "checked"
form.taxfield.value = "0"
}

Second - it is necessary for every form field to round to two decimal places, as in a monitary amount. Being sure not to round up to the next dollar amount! And i would like to try to put these two solutions together.

Thanks so much,

DES
 
You just need to add the condition in your function which displays the price and the tax - you basically have already got the algorithm.

You need to use domething like:

if(form.checkboxname.checked){

form.taxfield.value="0";
}

As part of the function. I presume you are calling this function to update the values, when any control is changed on the form?
If box is checked the 'checked' property returns true. :)
b2 - benbiddington@surf4nix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top