I have three radio buttons and one textbox. If user select one of those radio buttons and type something in the textbox which is the value of the textbox, I want that value to be the value of the radio button that is selected, now the user may enter the value into the text box and then select the radio button or first select a radio button then enter something to the textbox, anyway the value of radio button should be equal to textbox value that user enter!
additional explanation :
(I have three radio buttons and one text box in a form which is for shipment tracking, now what I need is when I type something in that textbox (which is the value) and select one of those three radio buttons then clicking on go (submit) textbox value and selected radio button value will pass through URL (get method) on the result page I see two different value, one for my textbox and one for the selected radio button ,now I want that selected radio button value be as exact as the textbox one so the selected radio button value should follow the textbox value and both be equal so for example when I type some number like 870 in the textbox and select one of those three radio buttons an submit the form the result page URL have to show the radio button value 870 as the textbox is.)
The important point is changing value is just an option I mean it's not necessary that radio button values being changed it could be empty of any value and then fill by textbox value. I just want the selected radio button value ( One of those three radio buttons which user selected ) to be the exact same as user typed in textbox.
function ship(radio) {
var n1 = document.getElementById('n1');
var button = document.getElementById(radio);
n1.value = button.value;
}
this will make the text input display the value of the selected radio button.
Thanks for your code moritana, but its not exactly what I need. I need textbox value which user type in textbox be the value of a radio button which user select from three radio buttons. so for example if user select radio button number 2 then type something in textbox that something could be the value of radio button number 2 which user select, that could happen to other radio buttons as well.
additional explanation :
(I have three radio buttons and one text box in a form which is for shipment tracking, now what I need is when I type something in that textbox (which is the value) and select one of those three radio buttons then clicking on go (submit) textbox value and selected radio button value will pass through URL (get method) on the result page I see two different value, one for my textbox and one for the selected radio button ,now I want that selected radio button value be as exact as the textbox one so the selected radio button value should follow the textbox value and both be equal so for example when I type some number like 870 in the textbox and select one of those three radio buttons an submit the form the result page URL have to show the radio button value 870 as the textbox is.)
Could you guys please give me a hand, thanks so much.
Bookmarks