467,915 Members | 1,177 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

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,obviously 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
  • viewed: 1391
Share:
7 Replies
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,obviously 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*****@discussions.microsoft.comwrote in message
news:56**********************************@microsof t.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,obviously 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.(basically the
control which is above all other controls having error)

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

"clickon" <cl*****@discussions.microsoft.comwrote in message
news:56**********************************@microsof t.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,obviously 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.(basically the
control which is above all other controls having error)

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

"clickon" <cl*****@discussions.microsoft.comwrote in message
news:56**********************************@microsof t.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,obviously 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********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.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.(basically the
control which is above all other controls having error)

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

"clickon" <cl*****@discussions.microsoft.comwrote in message
news:56**********************************@microso ft.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,obviously 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********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.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.(basically the
control which is above all other controls having error)

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

"clickon" <cl*****@discussions.microsoft.comwrote in message
news:56**********************************@microsof t.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,obviously 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 ValidationSummary 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
"ValidationSummaryOnSubmit" 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********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.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.(basically the
control which is above all other controls having error)
>
Siva M wrote:
>If using ASP.NET 2.0, use SetFocusOnError...
>>
>"clickon" <cl*****@discussions.microsoft.comwrote in message
>news:56**********************************@microso ft.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,obviously 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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Nitin | last post: by
1 post views Thread by clickon | last post: by
2 posts views Thread by Jonathan N. Little | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.