I didn't look through everything, but right off the top it appears there is
a typo.
This line:
if (document.form1.text_id.disabled = true)
should be:
if (document.form1.text_id.disabled == true)
1 equal sign is the symbol to set the left to the value on the right, and in
an 'if' statement will only be 'false' if the left was not successfully set
to the value on the right.
To check equality use the 2 equal signs. ==
William
-Original Message-
From: Priya Koya [mailto:priya23...@gmail.com]
Sent: Thursday, February 19, 2009 10:40 PM
To: cf-talk
Subject: JavaScript Validation in ColdFusion
Hi all,
I have an issue
Have a form and have the three raio buttons and I grouped it. Need to select
one option and depending on the option need to fill texboxes. I am able to
select the radio button and produce the error message.
I am trying to disable and enable textboxes and validate them depends on
radio button selection. I am able to disable and enable texboxes but unable
to validate boxes.
If I select Option1 It will disable text boxes
If I select option2 or option3 --- enable extboxes and validate boxes
textbox1 --- should validate the length=12, should be numeric, should not be
empty
textbox2 --- should validate the length=10, should be numeric, should not be
empty
Thanks,
Can anyone hel with this
cfform name='form1'
cfinput type=radio name=rb_deposit value= id =id_check onclick
=funcone() required=yes message=Please select
optionspanOption1/spanbr/
cfinput type=radio name=rb_deposit value= id =id_check1
onclick=check1()spanOption2/spanbr/
cfinput type=radio name=rb_deposit value= id =id_check2
onclick=check1()spanOption3/spanbr/
input type=text name=text1 value= id =text_id onBlur=check2()
spanlabel1/spanbr/
input type=text name=text2 value= id =text_id1
onBlur=check3()spanlabel2/spanbr/
cfinput name=submit value=submit id=submit_1 type='submit'br/
/cfform
script type=text/javascript
function funcone(){
if(document.form1.id_check.checked)
{
document.form1.text_id.disabled = true;
document.form1.text_id1.disabled = true;
return false;
}
else{return true;}
}
function check1()
{
if (document.form1.text_id.disabled = true)
{
document.form1.text_id.disabled =false;
document.form1.text_id1.disabled = false;
return false;
}
else{return true;}
}
function check2()
{
if(document.form1.id_check1.checked ||
document.form1.id_check2.checked)
{
document.form1.text1.focus();
if(document.form1.text1.value==
||!isNaN(document.form1.text1.value)||document.form1.text1.length !='12')
{
alert(Please enter BankNumber);
document.form1.text1.focus();
}else {return true;}
}
function check3()
{
if(document.form1.text1.value!=
||!isNaN(document.form1.text1.value))
{
if(document.form1.text2.value= ||
isNaN(document.form1.text2.value))
{
alert(Please enter Routing Number);
document.form1.text2.focus();
return false;
}
else {return true;}
}
}
}
/script
~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319592
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4