ASP.NET 2.0 custom validator javascript problem

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!
 
B

bannaman

Hmmm, well having a good look through your code it seems as though you
are using all lower case for isvalid. I would recommend you look at
this. Apart from that it looks fine.

Regards,

THE BEST (EASY EASY EASY)
 
G

ganniss

I have the same problem today useenmelat (if its any consolation).

I will post if I find a fix.
 
G

ganniss

Correction useenmelat, sorry, it was a bug in my javascript function
the methods needing to be precisely case dependent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top