Jump to content

Enable and disable textarea field..


siabanie

Recommended Posts

Hi all,

 

I wonder if anyone can give me some idea; I have a form with a drop down menu [bT,Virgin, None, Other] - When user select either [bT, Virgin,None] the textarea field will be disable. But when user select option [Other] the textarea will be available.

 

How can I do this?

 

..
..
<tr align="left" valign="top" <?php if ($_POST['action'] == "register") { if ($errornum[16] == "1") { echo 'class="error"'; } } ?>>
	<td>Who is your previous Internet Service Provider?</td>
	<td align="left">
	<select name="oldprovider">
		<option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "") { echo "selected"; } } ?>>		
			Select Provider.....
		</option><?php $prev_supplier="BT";?>
                                                  
		<option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register"){ if ($_POST['oldprovider'] == 
			"$prev_supplier") { echo "selected"; } } ?>>
			<?php echo $prev_supplier;?>
		</option><?php $prev_supplier="Virgin";?>
                                                  
		<option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == 
			"$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?>
		</option><?php $prev_supplier="None";?>
                                                  
											  
		<option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == 
			"$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?>
		</option><?php $prev_supplier="Other";?>

            <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == 
			"$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?>
		</option>
	</select>
<br /><br />
        <textarea name="oldprovider_text" cols="30" rows="2"> 
		<?php if ($_POST['action'] == "register") { echo $_POST['oldprovider_text']; } ?>
	</textarea></td>
</tr>

 

Thanks in advance.

Link to comment
Share on other sites

I think possibly javascript/jquery would be the best way to do this...so your for would be dynamic and wouldn't have to reload its self...but i'm not the best on how to do it...so i'd suggest to try in google jquery disable button and it should help hopefully

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.