disable submit button when page refresh with back button.

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/
iinfer [ Fr, 11 Februar 2011 03:08 ] [ ID #2055017 ]

Re: disable submit button when page refresh with back button.

On 02/10/2011 06:08 PM, iinfer wrote:
> 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.

The canonical community support medium for CGI scripts used to be the
Usenet news group "comp.infosystems.www.authoring.cgi". It looks like
Usenet has been assimilated into Google Groups, and that news feed is no
longer active:


http://groups.google.com/group/comp.infosystems.www.authorin g.cgi/topics

You cannot post messages because this group is only available as an
archive.


There are now many Perl mailing lists:

http://lists.perl.org/


Including one for CGI:

http://lists.perl.org/list/beginners-cgi.html


I'd suggest posting your question there.


HTH,

David

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
David Christensen [ Fr, 11 Februar 2011 17:19 ] [ ID #2055021 ]
Perl » gmane.comp.lang.perl.beginners » disable submit button when page refresh with back button.

Vorheriges Thema: OT: understanding the ||= operator
Nächstes Thema: print $myhash{key} gets SCALAR(0x1b8db540) instead of "0"