Am validating a form for empty check.
All fields works fine.
I have a dropdown when i select some value from dropdown some fields will be disabled. onchanging the dropdown value someother fields will be disabled.
Now am struck in validating the fields which are getting disabled and enabled.
if((document.form1.varAuctionTime.disabled = false) && (document.form1.varAuctionTime.value == ""))
I used above code but it is enabling the fields.
can anybody help me out.
I upvoted Quentin’s answer.
document.form1.varAuctionTime.disabled = falseuses the assignment operator, which sets the value ofdisabledtofalsedocument.form1.varAuctionTime.disabled == falsewill do a comparison and will returntrueif the value of disabled isfalse(or technically, if the value is0or an empty string)document.form1.varAuctionTime.disabled === falsewill only return true if the value isfalseand not if it is0or an empty string. This is probably not required as AFAIK thedisabledproperty will always return a boolean.To give you a few alternatives that you may prefer; since the comparison operators return booleans, and the
disabledproperty is a boolean anyway, you could just do the following