473,788 Members | 2,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

focus on control after an error

Hey,
I have a form in which there are say 10 fields. I am using validator
control for all the fields. suppose user forgets to fill field no. 5, 8
, 9 and 10.
So on clicking the save button,obviousl y an error willl be raised. Is
there anyway such that when the error is raised the focus goes to
first control that has false validation (e.g in our case that control
is 5) ? Right now after clicking the save button, none of the control
has the focus.

Aug 8 '06 #1
7 1562
Set the SetFocusOnError portery of the validator control. if you have client
side validation enabled as soon as the user moves out of the textbox, if
there is an error, the focus will immedietly move back to the relevent text
box.

"saurabh" wrote:
Hey,
I have a form in which there are say 10 fields. I am using validator
control for all the fields. suppose user forgets to fill field no. 5, 8
, 9 and 10.
So on clicking the save button,obviousl y an error willl be raised. Is
there anyway such that when the error is raised the focus goes to
first control that has false validation (e.g in our case that control
is 5) ? Right now after clicking the save button, none of the control
has the focus.

Aug 8 '06 #2
If using ASP.NET 2.0, use SetFocusOnError ...

"clickon" <cl*****@discus sions.microsoft .comwrote in message
news:56******** *************** ***********@mic rosoft.com...
Set the SetFocusOnError portery of the validator control. if you have
client
side validation enabled as soon as the user moves out of the textbox, if
there is an error, the focus will immedietly move back to the relevent text
box.

"saurabh" wrote:
Hey,
I have a form in which there are say 10 fields. I am using validator
control for all the fields. suppose user forgets to fill field no. 5, 8
, 9 and 10.
So on clicking the save button,obviousl y an error willl be raised. Is
there anyway such that when the error is raised the focus goes to
first control that has false validation (e.g in our case that control
is 5) ? Right now after clicking the save button, none of the control
has the focus.

Aug 8 '06 #3
I am using 1.1.4322 and couldnt find any property like that :( Tell me
is there any workaround ?
what if more than two controls have error. Which control will have the
focus?? in my case i want 5th control to get focus.(basicall y the
control which is above all other controls having error)

Siva M wrote:
If using ASP.NET 2.0, use SetFocusOnError ...

"clickon" <cl*****@discus sions.microsoft .comwrote in message
news:56******** *************** ***********@mic rosoft.com...
Set the SetFocusOnError portery of the validator control. if you have
client
side validation enabled as soon as the user moves out of the textbox, if
there is an error, the focus will immedietly move back to the relevent text
box.

"saurabh" wrote:
Hey,
I have a form in which there are say 10 fields. I am using validator
control for all the fields. suppose user forgets to fill field no. 5, 8
, 9 and 10.
So on clicking the save button,obviousl y an error willl be raised. Is
there anyway such that when the error is raised the focus goes to
first control that has false validation (e.g in our case that control
is 5) ? Right now after clicking the save button, none of the control
has the focus.
Aug 8 '06 #4
Sorry i forgot it's a .net 2.0 thing.

"saurabh" wrote:
I am using 1.1.4322 and couldnt find any property like that :( Tell me
is there any workaround ?
what if more than two controls have error. Which control will have the
focus?? in my case i want 5th control to get focus.(basicall y the
control which is above all other controls having error)

Siva M wrote:
If using ASP.NET 2.0, use SetFocusOnError ...

"clickon" <cl*****@discus sions.microsoft .comwrote in message
news:56******** *************** ***********@mic rosoft.com...
Set the SetFocusOnError portery of the validator control. if you have
client
side validation enabled as soon as the user moves out of the textbox, if
there is an error, the focus will immedietly move back to the relevent text
box.

"saurabh" wrote:
Hey,
I have a form in which there are say 10 fields. I am using validator
control for all the fields. suppose user forgets to fill field no. 5, 8
, 9 and 10.
So on clicking the save button,obviousl y an error willl be raised. Is
there anyway such that when the error is raised the focus goes to
first control that has false validation (e.g in our case that control
is 5) ? Right now after clicking the save button, none of the control
has the focus.
>
>

Aug 8 '06 #5
asp.net 1.1 does not provide this functionality.. To do this, you have to
write your own javascript code.

"saurabh" <sa********@gma il.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
>I am using 1.1.4322 and couldnt find any property like that :( Tell me
is there any workaround ?
what if more than two controls have error. Which control will have the
focus?? in my case i want 5th control to get focus.(basicall y the
control which is above all other controls having error)

Siva M wrote:
>If using ASP.NET 2.0, use SetFocusOnError ...

"clickon" <cl*****@discus sions.microsoft .comwrote in message
news:56******* *************** ************@mi crosoft.com...
Set the SetFocusOnError portery of the validator control. if you have
client
side validation enabled as soon as the user moves out of the textbox, if
there is an error, the focus will immedietly move back to the relevent
text
box.

"saurabh" wrote:
Hey,
I have a form in which there are say 10 fields. I am using validator
control for all the fields. suppose user forgets to fill field no. 5, 8
, 9 and 10.
So on clicking the save button,obviousl y an error willl be raised. Is
there anyway such that when the error is raised the focus goes to
first control that has false validation (e.g in our case that control
is 5) ? Right now after clicking the save button, none of the control
has the focus.


Aug 9 '06 #6
ohh and any idea how to do that in java script ???or any other
workaround exist ?

Kumar Reddi wrote:
asp.net 1.1 does not provide this functionality.. To do this, you have to
write your own javascript code.

"saurabh" <sa********@gma il.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
I am using 1.1.4322 and couldnt find any property like that :( Tell me
is there any workaround ?
what if more than two controls have error. Which control will have the
focus?? in my case i want 5th control to get focus.(basicall y the
control which is above all other controls having error)

Siva M wrote:
If using ASP.NET 2.0, use SetFocusOnError ...

"clickon" <cl*****@discus sions.microsoft .comwrote in message
news:56******** *************** ***********@mic rosoft.com...
Set the SetFocusOnError portery of the validator control. if you have
client
side validation enabled as soon as the user moves out of the textbox, if
there is an error, the focus will immedietly move back to the relevent
text
box.

"saurabh" wrote:

Hey,
I have a form in which there are say 10 fields. I am using validator
control for all the fields. suppose user forgets to fill field no. 5, 8
, 9 and 10.
So on clicking the save button,obviousl y an error willl be raised. Is
there anyway such that when the error is raised the focus goes to
first control that has false validation (e.g in our case that control
is 5) ? Right now after clicking the save button, none of the control
has the focus.
Aug 9 '06 #7
If you are using ValidationSumma ry control to list the error
messages..I will give you a hint, how you can approach the problem..

If you open WebUIValidation .js file, you would see
"ValidationSumm aryOnSubmit" function. This function determines if the
page is valid or not.. then if the page is not valid.. it will iterate
through all the invalid validators on the page and get the error
messages from them and list them in a bulleted format or other
according to the way you customize it.. So, you should be able to get
the ID's of all the invalid validator controls from this method.. so
see if you can solve your problem from there..

saurabh wrote:
ohh and any idea how to do that in java script ???or any other
workaround exist ?

Kumar Reddi wrote:
asp.net 1.1 does not provide this functionality.. To do this, you have to
write your own javascript code.

"saurabh" <sa********@gma il.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
>I am using 1.1.4322 and couldnt find any property like that :( Tell me
is there any workaround ?
what if more than two controls have error. Which control will have the
focus?? in my case i want 5th control to get focus.(basicall y the
control which is above all other controls having error)
>
Siva M wrote:
>If using ASP.NET 2.0, use SetFocusOnError ...
>>
>"clickon" <cl*****@discus sions.microsoft .comwrote in message
>news:56******* *************** ************@mi crosoft.com...
>Set the SetFocusOnError portery of the validator control. if you have
>client
>side validation enabled as soon as the user moves out of the textbox, if
>there is an error, the focus will immedietly move back to the relevent
>text
>box.
>>
>"saurabh" wrote:
>>
Hey,
I have a form in which there are say 10 fields. I am using validator
control for all the fields. suppose user forgets to fill field no. 5, 8
, 9 and 10.
So on clicking the save button,obviousl y an error willl be raised. Is
there anyway such that when the error is raised the focus goes to
first control that has false validation (e.g in our case that control
is 5) ? Right now after clicking the save button, none of the control
has the focus.
>
>
>
Aug 10 '06 #8

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

Similar topics

5
9671
by: Mike Hnatt | last post by:
I'd like the focus to be on "mycontrol" when the page is first loaded. I'm getting an undefined error and am assuming that I can't do this in the body ONLOAD event because the control is not yet rendered. (but I thought this would still work) <body onload="mycontrol.focus()"> Also, is there a way to not produce an error if that control does not exist? Thanks!
4
2219
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 time and there is also a check on that. If time is empty return error message. Again the explorer returns error message and then shifts the focus to date field, again error message and focus goes to time and this story goes on and on, untill...
3
2485
by: Dave | last post by:
We are developing a web page that shows large graphics. To provide more screen space for the graphics, we allow the user to popup a window that places itself over the top part of the browser. This popup contains a control panel that tells the main window what to display. Because we don't want to require that the user continually ALT-TAB to go between the main window and the popup (all user controls are on the popup) in the control panel...
0
1898
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 within a textbox that is part of a datagrid. To complicate things, the datagrid is part of a user control. The following code is all part of the user control. The validation part of the script works fine. However, when I try to set the focus...
2
4488
by: James | last post by:
Hi I have set up a subform in datasheet mode containing a second subform also in datasheet mode in order to be able to open it as a subdatasheet. In my application I make the first subform appear and disappear using the Visible property. If I make it visible (in code), open the subdatasheet (via mouse) and click anywhere on the subdatasheet, then make it invisible (in code) I get the infamous error 2165 'You can't
18
2450
by: Euphor2 | last post by:
I'm in school, taking a VB .NET 2003 course, and the teacher taught us how to use Sender.Focus() to return focus to the control from which focus was received. However, when I got home, and tried it on my own copy of VB .NET 2003, it doesn't seem to work, in fact the only method that comes up with Intellisense is GetType. I can't find any information anywhere either in the MSDN Library, or anywhere else for that matter. I was hoping...
1
2063
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
1
5138
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
2
2478
by: Jonathan N. Little | last post by:
As part of a JavaScript precheck form validation I noticed a problem with trying to return focus to the field with an error. I have setup a demo page. http://www.littleworksstudio.com/temp/usenet/focus.html To simulate the problem, just enter or change the "first" textbox and either click or tab to another control., it is tied to the onchange event. An alert box that simulates the "warning". When you close it the focus will not move...
0
9498
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
10364
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
10172
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
10110
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,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4069
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

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.