Question on the calculator form

Good afternoon.

There is a calculator form. With sending by email.

There are three text fields that display three prices, there are three radio buttons to be associated with these fields.

In short: the calculator calculated 3 prices for a person, for 45, 60 and 90 minutes. A person must choose to select one button, which should send the price for 45, 60 or 90 minutes to the mail.

Numbers should be passed from one value parameter to another and sent to the mail.


Answer 1

For a specific question, start here. And hereabout onchange…

updIt’s great that you do it yourself. Seriously.

For radio buttons, the contents of the value property do not appear in the user interface. The value property only has meaning when submitting a form. If a radio button is in checked state when the form is submitted, the name of the radio button is sent along with the value of the value property(if the radio button is not checked, no information is sent ).

All three will not be sent. This is radio, they have the same name, which means that the value that is selected will be sent. Specify a value for the radio button and that’s it.

upd2. re-read the comment. value, which is considered by you and you write it in input type="text"‘s write in the values ​​of these radio buttons. For radio buttons, you need to set the correspondence with the prices. set an id for them, for example:

<input type="radio" name="chb[]" id="r45" value="0">
<input type="radio" name="chb[]" id="r60" value="0">
<input type="radio" name="chb[]" id="r90" value="0">

when counting, write the corresponding values ​​in the script:

document.getElementById('r45').value = 1000;
document.getElementById('r60').value = 1500;
document.getElementById('r90').value = 2000;

when submitting the form, on the server, catch what is written in chb[], the selected price will be there.

Leave a reply

Please enter your comment!
Please enter your name here