troubleshooting Question

Enabling and disabling text input onclicking a radio button

Avatar of padmasambhava
padmasambhava asked on
7 Comments1 Solution287 ViewsLast Modified:
Hi Experts,

I'm writing an admin page for a site and this particular bit allows an admin to set the text that will be displayed when the system is down.  It comes in two flavors, one for taking it down immediately and the other to give a warning and then take it down.  The default message is to take it down immediately.

I've got two radio buttons to allow selecting one or the other and some javascript that should enable and disablethe textarea message text.  When the page loads it defaults to the default message but clicking on the other radio button doesn't seem to run the javascript to enable the other textarea.

Thanks for any insight.

<fieldset><legend>Take the site up or down</legend><hr>
<form method="post" action="admin_site_availability.asp" name="site_availability_form">
<table width="100%">
    <td width="10%"><input type="radio" name="rbMsgSource" value="useDefault" checked onclick="enableDefault()"></td>
    <td width="90%">Use this default message when you are taking the system down immediately.</td>
    <td><textarea name="txtDefaultMessage" rows="5" cols="35"><%= msgAvailabilityDefault %></textarea></td>

<table width="100%"
      <td width="10%"><input type="radio" name="rbMsgSource" value="useCustom" onclick="enableCustom()"></td>
      <td width="90%">Use this warning message and announcement message when you want to schedule a maintenance window.  Remember you must still take the system down at the proper time, and also bring it back up.</td>
      <td width="10%"></td>
      <td><textarea name="txtCustomWarning" rows="5" cols="35" disabled="true"><%= msgAvailabilityWarning %></textarea></td>
      <td width="10%"></td>
      <td><textarea name="txtCustomMessage" rows="5" cols="35" disabled="true"><%= msgAvailabilityCustom %></textarea></td>
    <td><input type="submit" value="Submit"></td>

<script type="text/javascript">
function enableDefault() {
function enableCustom() {
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros