M
michael
I am working on a form in which I have divided onto 5 separate pages (
hopefully for ease of completing ) which employ various field types
such as radio buttons, text and memo fields, a check box or two and
file upload fields.
a self-imposed constraint was to reduce the number of clicks, so I
turned to javascript to automate the process of moving from one page to
another, and would like to ensure this works in both ie and firefox.
having already pondered the use of writing to a cookie, but figured
that the number of people who'll be using the form will have cookies
disabled and far outweighs the 8 - 12% of those who have javascript
disabled and have opted for what I figure to be an easier solution,
which is to pass the variable data to the last page that will be
reviewed before submitting the data.
any assistance, as always, will be appreciated. and if anyone would
like to review the actual pages, just send me an email and I'll be more
than happy to forward them.
onto my first problem:
take the options selected and successfully pass them to the review
page. just can't seem to get them to show up on the page ( this is the
first selction page, central javascript page and the common final (
request review ) page, I still have 4 other pages that will need to
pass variables similarly ).
here's the code I'm using on my first selection page -
<form name="pageOne">
<p>
<input type="radio" name="optionGroupOne"
value="variableOptionOne">variable option 1
<br />
<input type="radio" name="optionGroupOne"
value="variableOptionTwo">variable option 2
</p>
<p>
<input type="radio" name="optionGroupOne"
value="variableOptionThree">variable option 3
<br />
<input type="radio" name="optionGroupOne"
value="variableOptionFour">variable option 4
</p>
<p>
<input type="radio" name="optionGroupOne"
value="variableOptionFive">variable option 5
</p>
<p>...and the second option is...</p>
<p>
<input type="radio" name="optionGroupTwo"
value="variableOptionOne">variable option 1
<br />
<input type="radio" name="optionGroupTwo"
value="variableOptionTwo">variable option 2
</p>
</form>
here's what I'm trying to do from a centralized javascript page -
function optionSelected ()
var requestType = "";
var server = "";
{
// want the value of the optionGroupOne radio buttton selected
for (var i = 0; i < 4; i++)
{
if
(document.forms['pageOne'].elements['optionGroupOne'].checked ==
"true")
{
requestType =
document.forms['pageOne'].elements['optionGroupOne'].value;
} // end if
} // end for
// want the value of the optionGroupTwo radio button selected
for (var i = 0; i < 1; i++)
{
if
(document.forms['pageOne'].elements['optionGroupTwo'].checked ==
"true")
{
server =
document.forms['pageOne'].element['optionGroupTwo'].value;
} // end if
} // end for
// open a new window so the variable data can be passed to it
window.open("reviewResults.html","Review Your Input");
} // end function
and when I try to retrieve the data on the last page -
<script type="text/JavaScript">
window.document.write(opener.document.optionGroupOne.value);
window.document.write("<p>"+opener.document.optionGroupTwo.value+"</p>");
</script>
hopefully for ease of completing ) which employ various field types
such as radio buttons, text and memo fields, a check box or two and
file upload fields.
a self-imposed constraint was to reduce the number of clicks, so I
turned to javascript to automate the process of moving from one page to
another, and would like to ensure this works in both ie and firefox.
having already pondered the use of writing to a cookie, but figured
that the number of people who'll be using the form will have cookies
disabled and far outweighs the 8 - 12% of those who have javascript
disabled and have opted for what I figure to be an easier solution,
which is to pass the variable data to the last page that will be
reviewed before submitting the data.
any assistance, as always, will be appreciated. and if anyone would
like to review the actual pages, just send me an email and I'll be more
than happy to forward them.
onto my first problem:
take the options selected and successfully pass them to the review
page. just can't seem to get them to show up on the page ( this is the
first selction page, central javascript page and the common final (
request review ) page, I still have 4 other pages that will need to
pass variables similarly ).
here's the code I'm using on my first selection page -
<form name="pageOne">
<p>
<input type="radio" name="optionGroupOne"
value="variableOptionOne">variable option 1
<br />
<input type="radio" name="optionGroupOne"
value="variableOptionTwo">variable option 2
</p>
<p>
<input type="radio" name="optionGroupOne"
value="variableOptionThree">variable option 3
<br />
<input type="radio" name="optionGroupOne"
value="variableOptionFour">variable option 4
</p>
<p>
<input type="radio" name="optionGroupOne"
value="variableOptionFive">variable option 5
</p>
<p>...and the second option is...</p>
<p>
<input type="radio" name="optionGroupTwo"
value="variableOptionOne">variable option 1
<br />
<input type="radio" name="optionGroupTwo"
value="variableOptionTwo">variable option 2
</p>
</form>
here's what I'm trying to do from a centralized javascript page -
function optionSelected ()
var requestType = "";
var server = "";
{
// want the value of the optionGroupOne radio buttton selected
for (var i = 0; i < 4; i++)
{
if
(document.forms['pageOne'].elements['optionGroupOne'].checked ==
"true")
{
requestType =
document.forms['pageOne'].elements['optionGroupOne'].value;
} // end if
} // end for
// want the value of the optionGroupTwo radio button selected
for (var i = 0; i < 1; i++)
{
if
(document.forms['pageOne'].elements['optionGroupTwo'].checked ==
"true")
{
server =
document.forms['pageOne'].element['optionGroupTwo'].value;
} // end if
} // end for
// open a new window so the variable data can be passed to it
window.open("reviewResults.html","Review Your Input");
} // end function
and when I try to retrieve the data on the last page -
<script type="text/JavaScript">
window.document.write(opener.document.optionGroupOne.value);
window.document.write("<p>"+opener.document.optionGroupTwo.value+"</p>");
</script>