/    Sign up×
Community /Pin to ProfileBookmark

disabling multiple selects in IE,Firefox,Netscape

Hi I have the following code to disable my form element in the case of the top element ‘categories’ value = 0

function checkifempty(){
if (document.getElementById(‘Select4’).value==”){
document.getElementById(‘dropdown’).disabled=true
document.getElementById(‘dropdown1’).disabled=true
document.getElementById(‘length’).disabled=true
document.getElementById(‘submit’).disabled=true
}
else
{
document.getElementById(‘dropdown’).disabled=false
document.getElementById(‘dropdown1’).disabled=false
document.getElementById(‘length’).disabled=false
document.getElementById(‘submit’).disabled=false
}
}
if (document.all ||getElementById(‘dropdown’))
setInterval(“checkifempty()”,100)

it loads on <body onload checkifempty()>
an uses the top select element onchange=”checkifempty()” to call the function if category cahnges…..so it all works sort of ok…but

I would like to have the states remembered after passing the option values to a <FORM NAME=”FORM2″ action=”<? print $_PHP_SELF; ?>” method=”POST” > tag in the page which basically passes data back to a header (php) which performs some calculation (needed to be hidden – serverside).
A. how do I get around the problem of firefox not doing the enable /disable function.
B. The remebered state issue.

One thing to remember is that the top 3 selects are populated dynamically in javascript.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @steveh spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.9,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...