473,322 Members | 1,501 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,322 software developers and data experts.

Focus Control Error After Validation Summary

Hi,

Does anyone have an idea of how to set focus to the first control after summary validation occurs. After clicking on the summary validation message box, the focus should be set to the first control that causes an error.

I am using asp.net and javascripts.So I am trying to solve the problem with a javascript.

Help!

Thanks
Jun 13 '07 #1
2 3360
Frinavale
9,735 Expert Mod 8TB
Hi,

Does anyone have an idea of how to set focus to the first control after summary validation occurs. After clicking on the summary validation message box, the focus should be set to the first control that causes an error.

I am using asp.net and javascripts.So I am trying to solve the problem with a javascript.

Help!

Thanks
Hi Luke!

You will need to register a hidden field and set it to the control that caused the error.

Eg:
Expand|Select|Wrap|Line Numbers
  1.  Me.Page.ClientScript.RegisterHiddenField("__InvalidCtrl", TXT_TextBoxControl.ClientID)
Then in your javascript:
Expand|Select|Wrap|Line Numbers
  1. ...
  2. document.getElementById(__InvalidCtr).focus();
  3.  
  4.  
You'll have to put in try catch blocks in case there is no control that was invalid...that way you aren't trying to set a null control's focus...

Hope this gets you pointed in the right direction!

-Frinny
Jun 13 '07 #2
Hi Frinny,

Thanks for the solution. I ll apply the script as suggested and hope that it ll solve the problem.
Jun 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Nitin | last post by:
Hi I have created function to check date and time. at the time of execution, if date is left empty the function returns the error message but then the focus goes to next field. Next filed is for...
0
by: ED M. | last post by:
Hello all...I'm new to the board. I have a problem that I hope someone here might be able to solve for me. I am doing some clientside validation using Javascript. The text I am testing is...
0
by: Miquel | last post by:
Hi all. I felt frustrated when developing an 'UserControl' derivated from textBox, because sequence event (and Validate event) seems to fail. I Always thought my code was wrong. But after...
2
by: Lucas Tam | last post by:
Hi all, I want to display an error message from a custom validator in my Validation Summary control. Do I need to build the ServerValidate Event handler in order to display an error...
2
by: Barbara Alderton | last post by:
I setup some standard Required Field Validation controls and one Custom validation control on an ASP.NET page (within a user control) to validate text entry. I also setup a Summary Control to post...
2
by: c676228 | last post by:
Hi, I have several user controls like email, phone,ssn etc. each has it's own validation message in its user control already. When I bring all those user controls in an aspx page, I would like to...
2
by: ticars | last post by:
I have a telephone number user control in which I need to validate the data entered (Required field validation and regular expression validation). The phone number is represented as 3 text boxes...
2
by: Luke Sayaw | last post by:
Hi, Does anyone have an idea of how to set focus to the first control after summary validation occurs. After clicking on the summary validation message box, the focus should be set to the first...
1
by: Sudarhan | last post by:
Hello frnds I have created a webbased form using asp and javascript .. while submitting the form i am validating the fields in the form .it validates the field and returns alert message. but when...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.