/    Sign up×
Community /Pin to ProfileBookmark

Radio Button and Input Text relationship

I have a question… I have a radio button and below that an input text field. The first, if the user selects ‘Select Producer’, it generates a pop-up window with a list of all different Producers. The input text allows the user to type 1 or more (seperated by a comma) a specific Producer #.

However, the business owner believes that the users will get confussed and click on the radio button to Select Producer but type in the text the producer Number. I am at a loss what kind of JavaScript will prevent the user from typing in the Input Text if he clicked on Select Producer. Can anyone help?

<tr>
<br><td>
<font style=”Helvetica” color=”#CC6633″><div align=”right”><b>Producer</b></div></td>
<td>
<div align=”left”>
<input type=”radio” name=”Producer” value=”AllProd” tabindex=”5″ align=”left” checked><b>All</b></div></td>
</tr>
<tr>
<td>
</td>
<td>
<div align=”left”><input type=”radio” name=”Producer” value=”notAllProd” tabindex=”5″ align=”left” ><b>Select Producer</b></div></td>
</tr>
<tr>
<td>
</td>
<td>
<input type=”text” size=”15″ name=”PRODnum” maxlength=”13″ tabindex=”40″ class=”textNumber”>
</td>
</tr>
</tbody>
</table>
</td>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Warren86Sep 20.2004 — Asiralia:

I think that if you hid the the text area when it isn't allowed to be used, that might work for you. I see that you have given a "name" to the text area, so I believe that to hide it, you can use this code.

document.getElementById('PRODnum').style.display = 'none';

To make it visible again, use this:

document.getElementById('PRODnum').style.display = "";
×

Success!

Help @Asiralia spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...