Hi,
I have the following html page which simply colects information, then
a second page send the data to a third page to show the results from
previous two pages. What I am tryinng to do is showing that no matter
how much forward you go, when you go back to the initial page the
first submit button should be disabled. My problem I believe resides
on the document.getElementById('insubmit').disable=true; no matter
what I do it does not work. Any ideas or suggestions will be greatly
appreciated. I believe I dont' have enough understanding on how to
control the buttons with a java script.
The code below will use the hidden1.cgi and hidden2.cg which are on my
ftp. You could run the html without a problem
Thank you for your time and for looking into it
Sorry if I am posting to much information.
<html>
<head>
<!-- Mimic Internet Explorer 7 -->
<meta http-equip="X-UA-Compatible" content="IE=EmulateIE7" >
<title>SPU - Module 1 Quiz - 3rd Edition Tech</title>
<script type="text/javascript">
<!--
window.onload = function()
{
var myform = document.getElementById("insubmit");
var myval = myform.value;
if (myval == "send data")
{
alert("I am in form1");
document.getElementById('insubmit').disable=true;
}
else
{
if (myform.value == "form2")
{
alert("I am in form2");
}
}
}
//-->
</script>
</head>
<br>
<form name="form1" method=POST target="_self" action="http://
iinfer.com/hidden/hidden1.cgi">
<br>
<h2>Please enter the following information:</h2>
Name:<INPUT NAME="name" id=inname MAXLENGTH="15" SIZE=15>
<br>
State:<INPUT NAME="state" MAXLENGTH="15" SIZE=15>
<br>
<INPUT TYPE="submit" name="submit" VALUE="send data" id=insubmit>
</form>
</body>
</html>
***************************** hidden1.cgi **********************
#!/usr/local/bin/perl -wT
use strict;
use CGI ':standard';
use CGI::Session;
my ($name, [at] keys);
$name=param('name');
print "Content-type:text/html\n\n";
print "<HTML><HEAD><TITLE>Using Hidden Fields</TITLE></HEAD><BODY>\n";
print "Thanks, $name for entering your personal data. Now choose which
items you'd like to purchase. \n";
print qq(<FORM name=form2 METHOD=POST ACTION="hidden2.cgi">\n);
print qq(<INPUT TYPE="hidden" name="mysubmit" value="send data"
id="idsubmit">\n);
print qq(Item <INPUT TYPE="text" NAME="item">\n);
[at] keys = param();
foreach my $key ( [at] keys) {
my $value=param($key);
print qq(<INPUT TYPE="hidden" NAME="$key" VALUE="$value">\n);
}
print qq(<INPUT TYPE="submit" VALUE="Send order">\n);
print "</FORM></BODY></HTML>\
****************************** hidden 2 ***********************
#!/usr/local/bin/perl -wT
use strict;
use CGI ':standard';
my ($name, $state, $item);
$name=param('name');
$state=param('state');
$item=param('item');
print "Content-type:text/html\n\n";
print '<HTML><HEAD><TITLE>Using Hidden Fields</TITLE></HEAD><BODY>';
print "The item ordered by $name from $state is";
print "<P>$item";
print "<P>Thanks. It's on its way.";
print '</BODY></HTML>';
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
