473,490 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Validators and javascript

How I can from client javascript know when one of my
textboxes, Radio Button List, drop down box, etc...
Validated to False when submitting the form.

I can get the page_Isvalid==false but i need to know which
control is empty or not selected, so i can put the
cursor...

//Sample code
if (page_Isvalid==false){
if (txt_box1.value.length<1){
document.GetElementById('txt_box1').Focus()
}
}

The code above works great but I don't now how to approach
when i have a dropdownbox, radioButton list, etc...
Thanks,
dmedina
Nov 17 '05 #1
1 2117
The way I do the DropDownList boxes is I have the selected item say
something like "make a selection" and it has a value of 0 (none of my other
values have a 0 value.) that value is hardcoded as part of the list. Yes I
did have to override the asp DropDownListBox to have this functionality, but
you could also do it by hand.

Then I step through it the same way you did with the TextBox except for the
list box.

if ( ddl_box1.value == "0" )
document.GetElementById( 'ddl_box1').focus()

HTH,

bill

"dmedina" <ja****@cox.net> wrote in message
news:25****************************@phx.gbl...
How I can from client javascript know when one of my
textboxes, Radio Button List, drop down box, etc...
Validated to False when submitting the form.

I can get the page_Isvalid==false but i need to know which
control is empty or not selected, so i can put the
cursor...

//Sample code
if (page_Isvalid==false){
if (txt_box1.value.length<1){
document.GetElementById('txt_box1').Focus()
}
}

The code above works great but I don't now how to approach
when i have a dropdownbox, radioButton list, etc...
Thanks,
dmedina

Nov 17 '05 #2

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

Similar topics

1
1192
by: cksj | last post by:
I have a button that will trigger validators. In one special case, I have to show a message box when the button is clicked. In the code behind, I added the following: ...
0
1145
by: interuser | last post by:
I have an existing large application that uses validators. I have a problem with the client side validators not working on netscape (and any browser other than IE). As you may already know, the...
4
1871
by: Ian Cox | last post by:
I have a web form that contains a Datagrid. This grid has a number of columns, one of which contains a text box and validator for that text box. Everything works fine, when I press the "Save"...
7
3382
by: Anushi | last post by:
I have a strange problem.. once I put any validators on my form, say a simple RequiredFieldValidator, then there is no postback happening. Even on a button click, there is no refreshing of the...
1
1647
by: Gabriel Lozano-Morán | last post by:
When using the tabstrip control combined with a multipage (several pageview) there is a problem when using validators. The problem is that validation also occurs on the validators that are not on...
2
1719
by: Axel Dahmen | last post by:
Hi, I've added a couple of validators to my page. Now I get a couple of Runtime Errors when I load the page (I have "Show client-script errors" enabled in IE6): "A Runtime Error has occurred....
2
1719
by: Mike Surcouf | last post by:
Hi I have some regex validators on my page set to dynamic and like the way they appear after you tab out of a field and also when you try to postback the form. All OK so far When I register...
8
2095
by: ShaneFowlkes | last post by:
For some reason, my validator controls stopped working when a form posts. They seems to work on fields that lose focus but if I submit a form with all empty fields, not of the required validators...
0
1095
by: just.an.imbecile | last post by:
Hello all, Here is a quick version of my problem. I have a website that consists of 4 ASPX pages. Every field is required by default, but on pages 1 and 2, there are several fields that can be...
2
1806
by: Alec MacLean | last post by:
Hi, I have a page using AJAX. The page has three modal popups that work fine when I don't have field validators in place. As soon as I put a validator in place, the popup "form" the validator...
0
7112
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
7146
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,...
1
6852
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...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4878
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...
0
4573
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1389
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 ...
1
628
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.