U
useenmelately
Hello,
I am working with asp.net 2.0 and have run into a problem with the
custom validators.
The client validation functions were originally written in vbscript,
but as this is not compatible with many browers i changed them to
javascript. This is where the problem came about, the exact same
functions written in javascript dont work!! Javascript is deifintely
working as there are other non-validations functions performing
correctly. I also know the logic in the functions is correct as i have
placed alerts at various points to ensure this. Below is an example of
the client code that im working with, any help much appreciated.
The vbscript version:
sub dateRequiredClient1(sender, args)
if not
(document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_panelParty1")
is nothing) and
(document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_panelParty1").style.display
= "inline") then
if
document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_partiesblockdeeddate1").value
<> "" then
if
document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_partiesblockunknown1").checked
then
args.isvalid = false
else
args.isvalid = true
end if
else
if
document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_partiesblockunknown1").checked
then
args.isvalid = true
else
args.isvalid = false
end if
end if
end if
end sub
Javascript Version:
function deedtypeRequiredClient1(sender, args)
{
if(document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_panelParty1")
!= null)
{
if(document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_partiesblockdeedtype1").value
!= "-1")
{
args.isvalid = true;
return;
}
else
{
args.isvalid = false;
return;
}
}
}
The custom validator is set up with the correct attributes set as it
works with the vbscript routine but not the javascript function!
I am working with asp.net 2.0 and have run into a problem with the
custom validators.
The client validation functions were originally written in vbscript,
but as this is not compatible with many browers i changed them to
javascript. This is where the problem came about, the exact same
functions written in javascript dont work!! Javascript is deifintely
working as there are other non-validations functions performing
correctly. I also know the logic in the functions is correct as i have
placed alerts at various points to ensure this. Below is an example of
the client code that im working with, any help much appreciated.
The vbscript version:
sub dateRequiredClient1(sender, args)
if not
(document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_panelParty1")
is nothing) and
(document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_panelParty1").style.display
= "inline") then
if
document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_partiesblockdeeddate1").value
<> "" then
if
document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_partiesblockunknown1").checked
then
args.isvalid = false
else
args.isvalid = true
end if
else
if
document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_partiesblockunknown1").checked
then
args.isvalid = true
else
args.isvalid = false
end if
end if
end if
end sub
Javascript Version:
function deedtypeRequiredClient1(sender, args)
{
if(document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_panelParty1")
!= null)
{
if(document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_partiesblockdeedtype1").value
!= "-1")
{
args.isvalid = true;
return;
}
else
{
args.isvalid = false;
return;
}
}
}
The custom validator is set up with the correct attributes set as it
works with the vbscript routine but not the javascript function!