Nope, 0 was the right number- it's the first form. But
in loading the variable I still have selectedValue =
Request.Form("Center")
No reference to which form. Should the form be
referenced, and if so, how?
Thanks for helping me with this.
Chuck
-----Original Message-----
Forms in an HTML document are in an array. The number is
the index of the
array. If it is the second form on the page, refer to it
as
document.forms[1]; There are other ways to reference it.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
message
The first one was right- more than 1 form on the page.
So how do I correctly reference the right form,
called "FrontPage_Form1"? As form(1)?
Or as form("FrontPage_Form1")?
Thanks.
Chuck
-----Original Message-----
You have a couple of alternatives. One is that there
is
more than one form
on the page. Another is that the form field exists
outside of the form.
Another is that the name of the select object
isn't "Center."
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
message
Hmm. Obviously I coded it wrong. The select field
name
is "Center." Here's what I entered, and it gives
me an
error stating "Error: 'document.forms.0.Center' is
null
or not an object" Code: 0
Code I used:
<%Dim selectedValue
selectedValue = Request.Form("Center")%>
<script type="text/javascript"><!--
for (var i = 0; i < document.forms
[0].selectName.options.length; i++)
{
if (document.forms[0].Center.options
.value
=="<%
=selectedValue%>")
{
document.forms[0].Center.selectedIndex = i;
break;
}
}
// --></script>
What did I foul up?
Thanks.
Chuck
-----Original Message-----
<%Dim selectedValue
selectedValue = Request.Form("selectName")%>
<script type="text/javascript"><!--
for (var i = 0; i < document.forms
[0].selectName.options.length; i++)
{
if (document.forms[0].selectName.options
.value ==
"<%=selectedValue%>")
{
document.forms
[0].selectName.selectedIndex =
i;
break;
}
}
// --></script>
Of course, if you have some OTHER reason for
wanting
to
store the value in
Session, that's easy:
<%Session("selectedValue") = selectedValue%>
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"Chuck" <[email protected]>
wrote in
message
I'm trying to accomplish 2 things: store a user's
select-
box response from a form in a session variable
and
then
repopulate that selection on the user's next
call to
the
form (following post action) so they don't have
to
reselect it. How???
Thanks!
.
.
.