I have a rather large web application I am developing and I'm trying to create a toolbar near the top of the page to make things more centralized and user friendly. Now the problem is that I have a form farther down in the page and I'm trying to get the current input selected (in this case a radio button) passed to the link above in the toolbar. Any ideas on how this can be done?
Here is the related code I have so far:
function get_form(form) {
var input = form.client_choice.value;
alert ("You typed: " + input);
}
<div id="toolbar">
<!-- the alert displays: "You typed: undefined" -->
<a href="#" onclick="get_form(fClients)">Open</a> |
<a href="#">History</a>
</div>
<form name="fClients">
<tr class="table-row-1">
<td><input type="radio" name="client_choice" value="client 1" /></td>
<td align="left">client 1</td>
</tr>
<tr class="table-row-2">
<td><input type="radio" name="client_choice" value="client 2" /></td>
<td align="left">client 2</td>
</tr>
</form>
Here is the related code I have so far:
function get_form(form) {
var input = form.client_choice.value;
alert ("You typed: " + input);
}
<div id="toolbar">
<!-- the alert displays: "You typed: undefined" -->
<a href="#" onclick="get_form(fClients)">Open</a> |
<a href="#">History</a>
</div>
<form name="fClients">
<tr class="table-row-1">
<td><input type="radio" name="client_choice" value="client 1" /></td>
<td align="left">client 1</td>
</tr>
<tr class="table-row-2">
<td><input type="radio" name="client_choice" value="client 2" /></td>
<td align="left">client 2</td>
</tr>
</form>