473,800 Members | 3,056 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET 2.0 custom validator javascript problem

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 dateRequiredCli ent1(sender, args)
if not
(document.getEl ementById("ctl0 0_ContentPlaceH older1_Wizard1_ panelParty1")
is nothing) and
(document.getEl ementById("ctl0 0_ContentPlaceH older1_Wizard1_ panelParty1").s tyle.display
= "inline") then
if
document.getEle mentById("ctl00 _ContentPlaceHo lder1_Wizard1_p artiesblockdeed date1").value
<> "" then
if
document.getEle mentById("ctl00 _ContentPlaceHo lder1_Wizard1_p artiesblockunkn own1").checked
then
args.isvalid = false
else
args.isvalid = true
end if
else
if
document.getEle mentById("ctl00 _ContentPlaceHo lder1_Wizard1_p artiesblockunkn own1").checked
then
args.isvalid = true
else
args.isvalid = false
end if
end if
end if
end sub
Javascript Version:

function deedtypeRequire dClient1(sender , args)
{

if(document.get ElementById("ct l00_ContentPlac eHolder1_Wizard 1_panelParty1")
!= null)
{

if(document.get ElementById("ct l00_ContentPlac eHolder1_Wizard 1_partiesblockd eedtype1").valu e
!= "-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!

Jan 18 '06 #1
3 5373
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)

Jan 18 '06 #2
I have the same problem today useenmelat (if its any consolation).

I will post if I find a fix.

us***********@h otmail.com wrote:
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!! !


Jan 18 '06 #3
Correction useenmelat, sorry, it was a bug in my javascript function
the methods needing to be precisely case dependent

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

I will post if I find a fix.

us***********@h otmail.com wrote:
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!! !


Jan 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4709
by: Assimalyst | last post by:
Hi, I'm pretty new to javascript and i'm struggling to get a custom validator working. I have a dropdownlist populated by a datareader, the top value of which is always "Please Select..." at index 0. How can i code a validator to be invalid if "Please Select..." is selected, but valid for any other value?
2
3922
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
1
1020
by: Jim Heavey | last post by:
Can I create a generic Javascrip custom validator in which I can pass multiple parameters? Looking at examples, it does not appear that I can. I want to create a custom validator which will look at the value of two controls and depending on those values either set the "style" of another control to either visible or invisible. Since the code is generic, I want to pass the names of the three controls to the javascript routine....sounds...
8
7838
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the VALUE ENTERED BY THE USER EXISTS IN THE DB , then THE ERROR MESSAGE OF THE COMPARE VALIDATOR SHOULD BE DISPLAYED. For this, I used the reference artiicle "http://msdn.microsoft.com/library/default.asp?url=/library/en-...
5
2930
by: Mattyw | last post by:
Hi, I'm relatively new to Web Forms, I have been using Required Field Validators and Regular Expression Validators on a Web Form I am developing and everything works as expected using Visual Studio.NET 2003 and VB code behind. I have a radio button and textbox, and basically i need the textbox to be required based on the user selecting "Yes" from the radio button. I've read through the newsgroups and found that a Custom Validator
2
1794
by: Alan Silver | last post by:
Hello, I have a custom validator on my page, and have the server-side code working fine. I want to add a client-side funtion as well, but am not sure how to wire it in so that it works with the other validators on the page. I specified the name of the Javascript function with the ClientValidationFunction attribute of the custom validator, and it is being called fine. However, if the validator returns false (ie bad
9
3138
by: wardy1975 | last post by:
Hi All, Looking for a little expert advice on a few web standards issues. I am currently trying to understand the impact of web standards for a web application I work with. I have been doing a lot of research in the areas of XHTML and WAI compliance, and am attempting to come up with a recommendation for our product in terms of standards level compliance. Ideally, I would like to be at XHTML 1.0 Strict. However, in my reading I have...
8
3930
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
5
1281
by: =?Utf-8?B?R2FyeSBMYXJpbWVy?= | last post by:
Created a Custom Validation Ctrl in EW2 to validate a text box entry. Want to make sure entry is evenly divisible by 7, and that value is not 0. However, args.IsValid = false, even if 77 is entered in text box. Tag and script that were added to page follow: <asp:CustomValidator id="CustomValidator1" runat="server" ClientValidationFunction="ClientValidateSerial3" ControlToValidate="SerialNumber3" Display="Dynamic" ErrorMessage="Entry...
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7573
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.