View Single Post
Old 08-30-2011, 08:37 PM   PM User | #1
jcdevelopment
Senior Coder

 
jcdevelopment's Avatar
 
Join Date: Oct 2007
Location: Cowboy Nation
Posts: 2,171
Thanks: 173
Thanked 257 Times in 257 Posts
jcdevelopment will become famous soon enoughjcdevelopment will become famous soon enough
Disabling a text field depending on 2 options

Not 100% sure why or how to make this work.

I have 5 options in a select drop-down. Only two of them are to disable a text field. I have written it successfully to disable on one option. How would I add the second option? I have tried many different ways, and i know its something small that i am missing.

Below is the code that does not work but shows the 2 options that disable my text field.

Code:
<script type="text/javascript">
    function type_disable() {
		var qr_type = document.getElementById('qr_type');
    var qr_owner = document.getElementById('qr_owner');
    if(qr_type.value == 'bio' || 'rebrand')
        qr_owner.disabled = true
    else
        qr_owner.disabled = false
}
	
</script>
Code:
<tr>
	
	<td align="right"><span class="re">*</span>Type: </td>
	<td align="left"> &nbsp;<select id="qr_type"  name="qr_type" onChange="type_disable()">
	
	<option value="0">Select Type</option>
		 <option value="property">Property Code</option> 
		 <option value="ipw">IPW Code</option> 
		 <option value="bio">Biography Code</option> 
		 <option value="rebrand">Rebrand Code</option> 
		 <option value="property_rebrand">Property-rebrand Code</option> 
		 </select>
	 
	 </td>
	<td ></td>
	</tr>

	
	<tr>
	
	<td align="right"><span class="re">*</span>Owner: </td>
	<td align="left"> &nbsp;<input type="textbox" name="qr_owner" id="qr_owner" size="30" value=""/></td>
	<td ></td>
	</tr>
Thanks for any help!
jcdevelopment is offline   Reply With Quote