Disabling Dropdown based on value range

This is a discussion on "Disabling Dropdown based on value range" within the JavaScript Forum section. This forum, and the thread "Disabling Dropdown based on value range are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 26th, 2007, 11:02
New Member
Join Date: Jan 2006
Location: Buckinghamshire
Age: 26
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Disabling Dropdown based on value range

Morning. Ive got the following code below which is being used to only enable a 2nd dropdown depending on the value of the 1st dropdown, at the moment however it also activating the last option in the dorpdown for some reason, the information is being pulled from a database, the code is below

Quote:
<script type="text/javascript">
function dd_enabledist() {
endist = document.getElementById('howheard_id');
disty = document.getElementById('distributor');
if (endist && disty) {
hhval = endist.options[endist.selectedIndex].value;
if ( hhval.toString() <= 4 ) {
// Enable the textbox
disty.disabled = false;
} else {
// Disable the textbox
disty.disabled = true;
}
}
}

// Run the function for onLoad
dd_enabledist();
</script>
The dropdown code is below, however its irrlevant here I think for the problem im having
Quote:
<select name="howheard_id" id="howheard_id" onchange="dd_howheard(); dd_enabledist();" <%if ind_type_id=2 then response.write "disabled=""true""" end if%>><%=GetSelect("SELECT howheard_id,howheard_text FROM Howheard_Lang WHERE howheard_live=1 and lang_id = " & session("lang_id")& " ORDER BY howheard_order", session("howheard_id")) %></select>
What I want to do is try and change the javascript so it is above the value of 1 and less than or equal to 4, it must be simple but im having problems with it, if I change it to ==2 on the hhval it works fine, but there are 3 values in the dropdown that need to activate the 2nd dropdown

Appreicated any help

Thanks

Mat
Reply With Quote

Reply

Tags
dropdown

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crazy disabling buttons 1840dsgn Flash & Multimedia Forum 1 Nov 1st, 2007 22:46
Out of range error csun PHP Forum 1 May 6th, 2007 14:16
can't convert table-based to css-based layout markus Web Page Design 21 Apr 25th, 2007 22:50
Updating using a range? BrokenImage Databases 2 Nov 18th, 2005 13:00
range object da_stimulator JavaScript Forum 0 Dec 6th, 2004 10:40


All times are GMT. The time now is 23:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43