|
 |
aspx thread: Form Validation Stops Redirect
Message #1 by "Hugh McLaughlin" <hugh@k...> on Fri, 23 Aug 2002 00:00:11
|
|
Hello everyone and thanks for your help in advance. I am working on an
application that uses a dropdownlist that allows the user to select a
function. Once selected, the browser is then redirected to the
appropriate page. This works fine in some pages, but in a few where I
have used >net form validation, the javascript stops the redirection,
instead requiring the required fields to be filled out before redirection
can occur. I am not sure how, or if there is a work-around for this.
Any help would be greatly appreciated. Thanks.
Message #2 by "Lindahl, Ron" <Ron.Lindahl@L...> on Fri, 23 Aug 2002 11:51:44 -0400
|
|
Perhaps I'm not fully understanding your question, but this behavior seems
to me to be by design. The reason for the validation is to make sure that
required fields contain valid data before recording the data and
transferring server execution to the next page in the application.
It seems to me that you want to change the validation routine to consider
empty strings as valid or drop validation altogether if you want to go to
the next page regardless of whether "required" fields contain data or not.
I apologize if I did not understand your issue fully.
-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: Thursday, August 22, 2002 8:00 PM
To: ASP+
Subject: [aspx] Form Validation Stops Redirect
Hello everyone and thanks for your help in advance. I am working on an
application that uses a dropdownlist that allows the user to select a
function. Once selected, the browser is then redirected to the
appropriate page. This works fine in some pages, but in a few where I
have used >net form validation, the javascript stops the redirection,
instead requiring the required fields to be filled out before redirection
can occur. I am not sure how, or if there is a work-around for this.
Any help would be greatly appreciated. Thanks.
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #3 by "Hugh McLaughlin" <hugh@k...> on Fri, 23 Aug 2002 17:15:17
|
|
Thanks for your response Ron. I wasn't very clear. Here is the scenario:
The header for each page contains a dropdownlist with a "Go" button that
allows the user to select a function and be redirected. On some of the
pages, I am using form field validation. the problem arises when a user
goes to a page, but then decides to not submit any data, instead
selecting another page and function. In this case, they are not trying
to submit anything. This could happen if the user simply went to the
wrong page. As you mentioned, it is truly "by design" behavior in one
case, since the form was not filled out. However, there was no attempt
to submit the form data. Instead, the user is simply trying to leave the
page. I suspect I will simply have to do server side validation, but was
wondering if there was another method.
> Perhaps I'm not fully understanding your question, but this behavior
seems
to me to be by design. The reason for the validation is to make sure that
required fields contain valid data before recording the data and
transferring server execution to the next page in the application.
It seems to me that you want to change the validation routine to consider
empty strings as valid or drop validation altogether if you want to go to
the next page regardless of whether "required" fields contain data or not.
I apologize if I did not understand your issue fully.
-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: Thursday, August 22, 2002 8:00 PM
To: ASP+
Subject: [aspx] Form Validation Stops Redirect
Hello everyone and thanks for your help in advance. I am working on an
application that uses a dropdownlist that allows the user to select a
function. Once selected, the browser is then redirected to the
appropriate page. This works fine in some pages, but in a few where I
have used >net form validation, the javascript stops the redirection,
instead requiring the required fields to be filled out before redirection
can occur. I am not sure how, or if there is a work-around for this.
Any help would be greatly appreciated. Thanks.
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #4 by "Lindahl, Ron" <Ron.Lindahl@L...> on Fri, 23 Aug 2002 17:06:04 -0400
|
|
Perhaps it's just the opinion of a humble .NET neophyte, but I think this is
fit for server side validation. The redirection has to be processed by the
server returning a page anyway, and generally ASP.NET tries to handle
everything with server side processing.
To handle the redirection in the code behind page, you can still use
Response.Redirect("url") just like old school ASP, or you can use
Server.Transfer("url"), which seems to be more .NET savvy than
Response.Redirect.
-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: Friday, August 23, 2002 1:15 PM
To: ASP+
Subject: [aspx] RE: Form Validation Stops Redirect
Thanks for your response Ron. I wasn't very clear. Here is the scenario:
The header for each page contains a dropdownlist with a "Go" button that
allows the user to select a function and be redirected. On some of the
pages, I am using form field validation. the problem arises when a user
goes to a page, but then decides to not submit any data, instead
selecting another page and function. In this case, they are not trying
to submit anything. This could happen if the user simply went to the
wrong page. As you mentioned, it is truly "by design" behavior in one
case, since the form was not filled out. However, there was no attempt
to submit the form data. Instead, the user is simply trying to leave the
page. I suspect I will simply have to do server side validation, but was
wondering if there was another method.
> Perhaps I'm not fully understanding your question, but this behavior
seems
to me to be by design. The reason for the validation is to make sure that
required fields contain valid data before recording the data and
transferring server execution to the next page in the application.
It seems to me that you want to change the validation routine to consider
empty strings as valid or drop validation altogether if you want to go to
the next page regardless of whether "required" fields contain data or not.
I apologize if I did not understand your issue fully.
-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: Thursday, August 22, 2002 8:00 PM
To: ASP+
Subject: [aspx] Form Validation Stops Redirect
Hello everyone and thanks for your help in advance. I am working on an
application that uses a dropdownlist that allows the user to select a
function. Once selected, the browser is then redirected to the
appropriate page. This works fine in some pages, but in a few where I
have used >net form validation, the javascript stops the redirection,
instead requiring the required fields to be filled out before redirection
can occur. I am not sure how, or if there is a work-around for this.
Any help would be greatly appreciated. Thanks.
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #5 by "Mingkun Goh" <mangokun@h...> on Sat, 24 Aug 2002 12:23:16
|
|
'Hugh McLaughlin', I think you can just ignore what 'Lindahl, Ron' have
said, because I dun think he fully understood your question.
Consider this:
On some webpages, the author uses a DropDownList to redirect the user to
another page.
Some (not ASP.NET) people just use client-side JavaScript to accomplish
this, whereas in your case, your webpage do a post-back, and your code on
the server side do the page redirect.
If I am not wrong, you have a 'Go' Button beside the DropDownList on your
webpage. After the user have selected a item in the DropDownList, he has
to click on the 'Go' Button.
Since you are using a 'Go' button, all that is needed to solve your
problem is to set its 'Cause Validation' property to 'False'.
Correct me if I am wrong.
Previous message:
> Hello everyone and thanks for your help in advance. I am working on an
a> pplication that uses a dropdownlist that allows the user to select a
f> unction. Once selected, the browser is then redirected to the
a> ppropriate page. This works fine in some pages, but in a few where I
h> ave used >net form validation, the javascript stops the redirection,
i> nstead requiring the required fields to be filled out before
redirection
c> an occur. I am not sure how, or if there is a work-around for this.
A> ny help would be greatly appreciated. Thanks.
Message #6 by "Mingkun Goh" <mangokun@h...> on Sat, 24 Aug 2002 12:34:01
|
|
Hugh, in case you dun know, you dun even need to have the 'Go' button on
your webpage just to do a page post-back.
You can just set the DropDownList's property 'AutoPostBack' to 'True'.
So when the user select an item from the DropDownList, the DropDownList
will cause a page post-back and its SelectedIndexChanged event will be
triggered.
Here is a sample code:
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
Response.Redirect("WebForm" & DropDownList1.SelectedItem.Value
& ".aspx")
End Sub
You can look in the .net Documentation for more info on 'AutoPostBack'.
Previous message:
> Hello everyone and thanks for your help in advance. I am working on an
a> pplication that uses a dropdownlist that allows the user to select a
f> unction. Once selected, the browser is then redirected to the
a> ppropriate page. This works fine in some pages, but in a few where I
h> ave used >net form validation, the javascript stops the redirection,
i> nstead requiring the required fields to be filled out before
redirection
c> an occur. I am not sure how, or if there is a work-around for this.
A> ny help would be greatly appreciated. Thanks.
Message #7 by "Hugh McLaughlin" <hugh@k...> on Sun, 25 Aug 2002 02:22:42
|
|
Thanks Mingkun. This is exactly what I was looking for and it worked
perfectly. Thanks again.
> 'Hugh McLaughlin', I think you can just ignore what 'Lindahl, Ron' have
s> aid, because I dun think he fully understood your question.
> Consider this:
O> n some webpages, the author uses a DropDownList to redirect the user
to
a> nother page.
S> ome (not ASP.NET) people just use client-side JavaScript to accomplish
t> his, whereas in your case, your webpage do a post-back, and your code
on
t> he server side do the page redirect.
> If I am not wrong, you have a 'Go' Button beside the DropDownList on
your
w> ebpage. After the user have selected a item in the DropDownList, he
has
t> o click on the 'Go' Button.
> Since you are using a 'Go' button, all that is needed to solve your
p> roblem is to set its 'Cause Validation' property to 'False'.
> Correct me if I am wrong.
>
P> revious message:
>> Hello everyone and thanks for your help in advance. I am working on
an
a> > pplication that uses a dropdownlist that allows the user to select a
f> > unction. Once selected, the browser is then redirected to the
a> > ppropriate page. This works fine in some pages, but in a few where
I
h> > ave used >net form validation, the javascript stops the redirection,
i> > nstead requiring the required fields to be filled out before
r> edirection
c> > an occur. I am not sure how, or if there is a work-around for
this.
A> > ny help would be greatly appreciated. Thanks.
|
|
 |