473,394 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

IMP:ValidationSummary/CustomValidator/ResetBtn

SMG
Hi All.
My forms has two textboxes, 1 username, 2 password.
Both has requiredfield validator it works fine when there is no input in
these textboxes.
And the errorMsg is shown in ValidationSummary.

Now I want to check the username should contain only chatacters,
( I want to use customvalidator), when i enter char+number it trap the event
of customvalidator but it doesn't show the errormsg in the customValidator
and submits the form.

=======================
The Customvalidator & ValidationSummary code is as follows :
=======================
<asp:CustomValidator id="valCust" ErrorMessage="Please Enter Proper User
Name" ControlToValidate="txtUserName" Runat="server"></asp:CustomValidator>

<asp:ValidationSummary Runat="server" ID="valValSumm" Height="31px"
Width="281px"></asp:ValidationSummary>

=======================
The javascript function is as follows
=======================
function PropUserName(source, argument) {
var ValidChars = "abcdefghijklmnopqrstuvwxyz";
var Char; var sText=document.getElementById("txtUserName").value ;
for (i = 0; i < sText.length; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
arguments.IsValid = false;
// alert("Please Enter Proper Name")
return;
}
} return;
}
====================

It gives the alert from the javascript function, but it doesn't show the
ErrorMsgs associated with CustomValidator??????

Can anyone tell me where I am wrong?

One more how do i reset the form values ?
Is there any other way than this "<input type=reset value=reset>" will my
error msgs will disappear with this? if not then how do i reset the form
values and disable the errormsgs in validationSummary.
regards,
SMG
Nov 18 '05 #1
1 1803
"SMG" <sh*************@idealake.com> wrote in message
news:uh**************@tk2msftngp13.phx.gbl...
Hi All.
My forms has two textboxes, 1 username, 2 password.
Both has requiredfield validator it works fine when there is no input in
these textboxes.
And the errorMsg is shown in ValidationSummary.

Now I want to check the username should contain only chatacters,
( I want to use customvalidator), when i enter char+number it trap the event of customvalidator but it doesn't show the errormsg in the customValidator
and submits the form.

=======================
The Customvalidator & ValidationSummary code is as follows :
=======================
<asp:CustomValidator id="valCust" ErrorMessage="Please Enter Proper User
Name" ControlToValidate="txtUserName" Runat="server"></asp:CustomValidator>
<asp:ValidationSummary Runat="server" ID="valValSumm" Height="31px"
Width="281px"></asp:ValidationSummary>


You do not reference your JavaScript function in your CustomValidator tag.

Take a look at ASP.NET Validation in Depth
(http://msdn.microsoft.com/library/de...-us/dnaspp/htm
l/aspplusvalid.asp) from MSDN.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2

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

Similar topics

7
by: jcpmeticulus | last post by:
Hi I've spent the last day or so debugging a problem with a CustomValidator and am now totally stumped! Basically I use a number of CustomValidator's on my page, but have cut this down now to...
1
by: bill yeager | last post by:
I'm using the customvalidator in my web page. I get the following error when I try to run the web page: Unable to find control id 'lstRider' referenced by the 'ControlToValidate' property of...
2
by: Stephen Miller | last post by:
Can the CustomValidator be used to simply report unexpected errors, without requiring Client/Server validation? To explain, say you had a simple text box and button that did a Full-text Search of a...
3
by: Ronan Dodworth | last post by:
Hi there I'm having a little bit of a problem with my customvalidator control. The problem is the javascript runs fine on my local webserver IIS but not when I post it to the web hosting server....
3
by: philipl | last post by:
hi, i have a textbox in my edititemtemplate in my datagrid. I have created a customvalidator for it, when i update the row the appropiate function gets called to customvalidate but the problem...
0
by: ghafranabbas | last post by:
This is how you use the customvalidator control in any INamingContainer interface control (Datagrid, DataList, DataRepeater, etc). 1. In the ItemTemplate, place your customvalidator 2. Set the...
1
by: Beffmans | last post by:
Hi I have defined an customvalidator on my TextBox: function clientvalidate(source, arguments){ { // even number? if (arguments.Value%2 == 0) arguments.IsValid = true; else
1
by: David | last post by:
I need help with CustomValidator in 1.1. I added the CustomValidator control and code as per the doc., (See below) However, the code is never executed. Is there an extra switch or setting to...
2
by: Jeff | last post by:
hey net 3.5 I have problem with a customvalidator. I enter values into the TextBox named "txt" and clicks on the save button (ibSave) then the TestValidate method get triggered. TestValidate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.