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
https://forums.phpfreaks.com/topic/230705-enable-and-disable-textarea-field/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.