|
 |
asptoday_discuss thread: Maintaining State with Selection Menus
Message #1 by "Jeremy Palmer" <medicalendar@h...> on Wed, 12 Jun 2002 18:59:46
|
|
Hello Everybody,
I have a web application that contains a form and a few selection menus.
When the form is submitted, I run a validation script to check out the
data. If there is a problem with the data, I send the user back to the
page with the appropriate error message(s). However, when I do this, all
of the selection menus are reset to their default position. How can I
prevent this from happening. How can I maintain state for selection menus?
Thanks,
Jeremy
Message #2 by =?iso-8859-1?q?asame=20obiomah?= <asame00@y...> on Wed, 12 Jun 2002 19:22:37 +0100 (BST)
|
|
--0-1370446389-1023906157=:35625
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
1. You will need to have a unique way of identifying your users. The easiest way is through login or cookies (you could also use
Sesion.SessionID - valid for current session only)
2. Set the menu source to a unique application scope array for each user - using their unique ID. Alternatively, use the slower, but
less memory intensive database method with the unique ID as Key ...speed up access with getString method (database array).
...Voila!
Jeremy Palmer <medicalendar@h...> wrote: Hello Everybody,
I have a web application that contains a form and a few selection menus.
When the form is submitted, I run a validation script to check out the
data. If there is a problem with the data, I send the user back to the
page with the appropriate error message(s). However, when I do this, all
of the selection menus are reset to their default position. How can I
prevent this from happening. How can I maintain state for selection menus?
Thanks,
Jeremy
---------------------------------
Sign up to watch the FIFA World Cup video highlights from your desk!
http://fifaworldcup.yahoo.com/fc/en
Message #3 by "Igor Mihacic" <igorm@p...> on Thu, 13 Jun 2002 01:32:44 +0200
|
|
Hello!
If you process the input form with an asp page you could do this.
input.asp // your form
process.asp // the script which process the input form and display the
message
.. and on the process.asp script you put a back link like this:
<a href="javascript:self.history.go(-1)">corret the data</a>
The other way is using javascript for checking the form. If so .. only when
the data procesd by your JS is OK is passed to some .asp file.
bye,
-- igor
> Subject: Maintaining State with Selection Menus
> From: "Jeremy Palmer" <medicalendar@h...>
> Date: Wed, 12 Jun 2002 18:59:46
> X-Message-Number: 1
>
> Hello Everybody,
>
> I have a web application that contains a form and a few selection menus.
> When the form is submitted, I run a validation script to check out the
> data. If there is a problem with the data, I send the user back to the
> page with the appropriate error message(s). However, when I do this, all
> of the selection menus are reset to their default position. How can I
> prevent this from happening. How can I maintain state for
> selection menus?
>
> Thanks,
>
> Jeremy
Message #4 by "Bryan Ax" <bax@k...> on Thu, 13 Jun 2002 08:48:04 +0900
|
|
Jeremy:
Are you posting to a different page, or the same page? If you post to
the same page, you can do something like this:
<input type="radio" name="MyRadioButton" value="4" <%if
request.Form("MyRadioButton") = "4" then response.write "checked"%>>By
mail</p>
Basically, this will just look in the request.Form collection to see if
the current item was what was chosen. If it was, it hilites it.
Same principle applies for dropdown lists.
<select name="goo">
<option value = "1" <%if request.Form("goo") = "1" then response.write
"selected"%>>-- Choose Location --</option>
<option value = "2" <%if request.Form("goo") = "2" then response.write
"selected"%>>Participant's home or workplace</option>
</select>
Of course, this can get a bit cumbersome, so it's worth it to try and
write a few routines to handle the display.
Feel free to ask if you have additional questions. There's no need that
I can think of that you need to maintain login or cookie information to
accomplish this. I do this all the time.
Bryan
Subject: Re: Maintaining State with Selection Menus
From: =?iso-8859-1?q?asame=20obiomah?= <asame00@y...>
Date: Wed, 12 Jun 2002 19:22:37 +0100 (BST)
X-Message-Number: 2
--0-1370446389-1023906157=:35625
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
1. You will need to have a unique way of identifying your users. The
easiest way is through login or cookies (you could also use
Sesion.SessionID - valid for current session only)
2. Set the menu source to a unique application scope array for each user
- using their unique ID. Alternatively, use the slower, but less memory
intensive database method with the unique ID as Key ...speed up access
with getString method (database array).
...Voila!
Jeremy Palmer <medicalendar@h...> wrote: Hello Everybody,
I have a web application that contains a form and a few selection menus.
When the form is submitted, I run a validation script to check out the
data. If there is a problem with the data, I send the user back to the
page with the appropriate error message(s). However, when I do this, all
of the selection menus are reset to their default position. How can I
prevent this from happening. How can I maintain state for selection
menus?
Thanks,
Jeremy
Message #5 by "Jeremy Palmer" <medicalendar@h...> on Thu, 13 Jun 2002 16:45:52
|
|
Hello Bryan,
Your reply seems to be right on target for what I am trying to
accomplish. That is how I have thought about doing it. The only caveat
that I can see is going between the HTML and ASP code so many times. For
example let's say I have a drop down list with all 50 states. I would
have to go back and forth between HTML and ASP code 50 times. I have
heard this can significantly slow down a page, or a web server. What are
your thoughts?
Thanks again!
Jeremy
> Jeremy:
Are you posting to a different page, or the same page? If you post to
the same page, you can do something like this:
<input type="radio" name="MyRadioButton" value="4" <%if
request.Form("MyRadioButton") = "4" then response.write "checked"%>>By
mail</p>
Basically, this will just look in the request.Form collection to see if
the current item was what was chosen. If it was, it hilites it.
Same principle applies for dropdown lists.
<select name="goo">
<option value = "1" <%if request.Form("goo") = "1" then response.write
"selected"%>>-- Choose Location --</option>
<option value = "2" <%if request.Form("goo") = "2" then response.write
"selected"%>>Participant's home or workplace</option>
</select>
Of course, this can get a bit cumbersome, so it's worth it to try and
write a few routines to handle the display.
Feel free to ask if you have additional questions. There's no need that
I can think of that you need to maintain login or cookie information to
accomplish this. I do this all the time.
Bryan
Subject: Re: Maintaining State with Selection Menus
From: =?iso-8859-1?q?asame=20obiomah?= <asame00@y...>
Date: Wed, 12 Jun 2002 19:22:37 +0100 (BST)
X-Message-Number: 2
--0-1370446389-1023906157=:35625
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
1. You will need to have a unique way of identifying your users. The
easiest way is through login or cookies (you could also use
Sesion.SessionID - valid for current session only)
2. Set the menu source to a unique application scope array for each user
- using their unique ID. Alternatively, use the slower, but less memory
intensive database method with the unique ID as Key ...speed up access
with getString method (database array).
...Voila!
Jeremy Palmer <medicalendar@h...> wrote: Hello Everybody,
I have a web application that contains a form and a few selection menus.
When the form is submitted, I run a validation script to check out the
data. If there is a problem with the data, I send the user back to the
page with the appropriate error message(s). However, when I do this, all
of the selection menus are reset to their default position. How can I
prevent this from happening. How can I maintain state for selection
menus?
Thanks,
Jeremy
Message #6 by "Greg Jennings" <greg.jennings@t...> on Thu, 13 Jun 2002 17:12:30
|
|
You could write out the entire HTML string for each option with a single
Response.Write and not switch back to HTML until done with all the options.
For example:
<form action=<% =Request.ServerVariables("SCRIPT_NAME") %> method=post>
<select name="State">
<%
dim StateValue
StateValue = Request.Form("State")
Response.Write( "<option value=1" )
If StateValue="1" Then Response.Write( " selected")
Response.Write( ">Alabama</option>" & vbCrLf )
Response.Write( "<option value=2" )
If StateValue="2" Then Response.Write( " selected")
Response.Write( ">Alaska</option>" & vbCrLf )
Response.Write( "<option value=3" )
If StateValue="3" Then Response.Write( " selected")
Response.Write( ">Arizona</option>" & vbCrLf )
%>
</select>
<input type=submit>
</form>
> Hello Bryan,
> Your reply seems to be right on target for what I am trying to
a> ccomplish. That is how I have thought about doing it. The only caveat
t> hat I can see is going between the HTML and ASP code so many times.
For
e> xample let's say I have a drop down list with all 50 states. I would
h> ave to go back and forth between HTML and ASP code 50 times. I have
h> eard this can significantly slow down a page, or a web server. What
are
y> our thoughts?
> Thanks again!
> Jeremy
> > Jeremy:
> Are you posting to a different page, or the same page? If you post to
t> he same page, you can do something like this:
> <input type="radio" name="MyRadioButton" value="4" <%if
r> equest.Form("MyRadioButton") = "4" then response.write "checked"%>>By
m> ail</p>
> Basically, this will just look in the request.Form collection to see if
t> he current item was what was chosen. If it was, it hilites it.
> Same principle applies for dropdown lists.
> <select name="goo">
<> option value = "1" <%if request.Form("goo") = "1" then response.write
"> selected"%>>-- Choose Location --</option>
<> option value = "2" <%if request.Form("goo") = "2" then response.write
"> selected"%>>Participant's home or workplace</option>
<> /select>
> Of course, this can get a bit cumbersome, so it's worth it to try and
w> rite a few routines to handle the display.
> Feel free to ask if you have additional questions. There's no need that
I> can think of that you need to maintain login or cookie information to
a> ccomplish this. I do this all the time.
> Bryan
>
S> ubject: Re: Maintaining State with Selection Menus
F> rom: =?iso-8859-1?q?asame=20obiomah?= <asame00@y...>
D> ate: Wed, 12 Jun 2002 19:22:37 +0100 (BST)
X> -Message-Number: 2
> --0-1370446389-1023906157=:35625
C> ontent-Type: text/plain; charset=iso-8859-1
C> ontent-Transfer-Encoding: 8bit
>
> 1. You will need to have a unique way of identifying your users. The
e> asiest way is through login or cookies (you could also use
S> esion.SessionID - valid for current session only)
2> . Set the menu source to a unique application scope array for each user
-> using their unique ID. Alternatively, use the slower, but less memory
i> ntensive database method with the unique ID as Key ...speed up access
w> ith getString method (database array).
.> ..Voila!
> Jeremy Palmer <medicalendar@h...> wrote: Hello Everybody,
> I have a web application that contains a form and a few selection menus.
> When the form is submitted, I run a validation script to check out the
d> ata. If there is a problem with the data, I send the user back to the
p> age with the appropriate error message(s). However, when I do this, all
> of the selection menus are reset to their default position. How can I
p> revent this from happening. How can I maintain state for selection
m> enus?
> Thanks,
> Jeremy
>
Message #7 by "Jeremy Palmer" <medicalendar@h...> on Thu, 13 Jun 2002 18:54:12
|
|
Thank you! That should solve the problem.
Best Regards,
Jeremy
> You could write out the entire HTML string for each option with a single
R> esponse.Write and not switch back to HTML until done with all the
options.
> For example:
> <form action=<% =Request.ServerVariables("SCRIPT_NAME") %> method=post>
> <select name="State">
> <%
d> im StateValue
S> tateValue = Request.Form("State")
> Response.Write( "<option value=1" )
I> f StateValue="1" Then Response.Write( " selected")
R> esponse.Write( ">Alabama</option>" & vbCrLf )
> Response.Write( "<option value=2" )
I> f StateValue="2" Then Response.Write( " selected")
R> esponse.Write( ">Alaska</option>" & vbCrLf )
> Response.Write( "<option value=3" )
I> f StateValue="3" Then Response.Write( " selected")
R> esponse.Write( ">Arizona</option>" & vbCrLf )
%> >
> </select>
> <input type=submit>
<> /form>
>
>
>> Hello Bryan,
> > Your reply seems to be right on target for what I am trying to
a> > ccomplish. That is how I have thought about doing it. The only
caveat
t> > hat I can see is going between the HTML and ASP code so many times.
F> or
e> > xample let's say I have a drop down list with all 50 states. I would
h> > ave to go back and forth between HTML and ASP code 50 times. I have
h> > eard this can significantly slow down a page, or a web server. What
a> re
y> > our thoughts?
> > Thanks again!
> > Jeremy
> > > Jeremy:
> > Are you posting to a different page, or the same page? If you post to
t> > he same page, you can do something like this:
> > <input type="radio" name="MyRadioButton" value="4" <%if
r> > equest.Form("MyRadioButton") = "4" then response.write "checked"%>>By
m> > ail</p>
> > Basically, this will just look in the request.Form collection to see if
t> > he current item was what was chosen. If it was, it hilites it.
> > Same principle applies for dropdown lists.
> > <select name="goo">
<> > option value = "1" <%if request.Form("goo") = "1" then response.write
"> > selected"%>>-- Choose Location --</option>
<> > option value = "2" <%if request.Form("goo") = "2" then response.write
"> > selected"%>>Participant's home or workplace</option>
<> > /select>
> > Of course, this can get a bit cumbersome, so it's worth it to try and
w> > rite a few routines to handle the display.
> > Feel free to ask if you have additional questions. There's no need that
I> > can think of that you need to maintain login or cookie information to
a> > ccomplish this. I do this all the time.
> > Bryan
> >
S> > ubject: Re: Maintaining State with Selection Menus
F> > rom: =?iso-8859-1?q?asame=20obiomah?= <asame00@y...>
D> > ate: Wed, 12 Jun 2002 19:22:37 +0100 (BST)
X> > -Message-Number: 2
> > --0-1370446389-1023906157=:35625
C> > ontent-Type: text/plain; charset=iso-8859-1
C> > ontent-Transfer-Encoding: 8bit
> >
> > 1. You will need to have a unique way of identifying your users. The
e> > asiest way is through login or cookies (you could also use
S> > esion.SessionID - valid for current session only)
2> > . Set the menu source to a unique application scope array for each
user
-> > using their unique ID. Alternatively, use the slower, but less memory
i> > ntensive database method with the unique ID as Key ...speed up access
w> > ith getString method (database array).
.> > ..Voila!
> > Jeremy Palmer <medicalendar@h...> wrote: Hello Everybody,
> > I have a web application that contains a form and a few selection
menus.
> > When the form is submitted, I run a validation script to check out the
d> > ata. If there is a problem with the data, I send the user back to the
p> > age with the appropriate error message(s). However, when I do this,
all
> > of the selection menus are reset to their default position. How can I
p> > revent this from happening. How can I maintain state for selection
m> > enus?
> > Thanks,
> > Jeremy
> >
|
|
 |