Submit form automatically - not the submit button
11-25-05, 03:56 PM
Newbie Coder
Join Date: Mar 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Submit form automatically - not the submit button
i searched on google and this script submits the form automatically after 5 seconds
this seems to work fine, however, the button i want to submit is not "submit"
this is what it looks like
however, when I try replacing "submit()" with "next()" it doesnt work. basically i want to submit the "Next" button after 5 seconds, not "Submit" button.
I really appreciate your help.
11-25-05, 04:22 PM
Community Leader
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Replace "test" with the form name!
11-25-05, 04:31 PM
Newbie Coder
Join Date: Mar 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
form name is test. here is how i have it:
11-25-05, 04:35 PM
Community Leader
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
11-25-05, 05:00 PM
Newbie Coder
Join Date: Mar 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
well, i have two buttons. one called "next" and one called "submit"
I want it to hit the "next" button and not submit.
for some reason, form just refreshes the page for me every 5 seconds.
11-25-05, 05:03 PM
Newbie Coder
Join Date: Mar 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
i took out the other submit button, and here is how it looks like now, it just keeps refreshing the page.
Code:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<!-- begin header.inc.php -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Vaelt.com</title>
<meta http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html" />
<meta name="author" content="Brandon Tallent" />
<style type="text/css">
body {background-color: #FFFFFF;
color: #000000;
font-family: Verdana, Helvetica, Sans-Serif;
font-size: 10pt; }
A:link {text-decoration: underline;
color: #0000FF; }
A:visited {text-decoration: underline;
color: #0000FF; }
A:active {text-decoration: underline;
color: #FF9933; }
A:hover {text-decoration: underline;
color: #FF0000}
td, pre {font-family: Verdana, Helvetica, Sans-Serif;
font-size: 10pt; }
input, textarea, select, option
{font-family: Verdana, Helvetica, Sans-Serif;
font-size: 10pt; }
input.timer {font-family: Verdana, Helvetica, Sans-Serif;
font-size: 12pt;
font-weight: bold;
border: 1px;
border-style: solid;
border-color: #EEEEEE;
background-color: #EEEEEE; }
.small {font-family: Tahoma, Arial, Helvetica, Sans-Serif;
font-size: 8pt; }
.config {font-family: Courier New, Courier, Sans-Seif;
font-size: 10pt; }
.answers {font-family: Verdana, Arial, Helvetica, Sans-Serif;
font-size: 8pt; }
.feedback {color: #ff0000;
font-weight: bold; }
.correct {color: #00aa00;
font-weight: bold; }
.incorrect {color: #ff0000;
font-weight: bold; }
.smallbold {font-family: Tahoma, Arial, Helvetica, Sans-Serif;
font-size: 8pt;
color: #ff0000;
font-weight: bold; }
.normal {font-family: Arial, Helvetica, Sans-Sefif; }
.form {font-family: Verdana, Helvetica, Sans-Serif;
background-color: #EEEEEE;
border-width: 1px;
border-style: solid;
border-color: #659ACC;
padding: 10px; }
.test {font=family: Verdana, Helvetica, Sans-Serif;
border-width: 1px;
border-style: solid;
border-color: #659ACC; }
.code_sample {
border-width: 1px;
border-style: solid;
background-color: #eeeeee;
border-color: #dddddd;
padding: 1px; }
.even {font-family: Verdana, Helvetica, Sans-Serif;
border-width: 1px;
border-style: solid;
background-color: #E5F3FF;
border-color: #659ACC;
padding: 5px; }
.odd {font-family: Verdana, Helvetica, Sans-Serif;
border-width: 1px;
border-style: solid;
background-color: #BDDFFF;
border-color: #659ACC;
padding: 5px; }
.answer {font-family: Verdana, Helvetica, Sans-Serif;
border-width: 1px;
border-style: solid;
background-color: #B1FFB1;
border-color: #659ACC;
padding: 5px; }
.blank {font-family: Verdana, Helvetica, Sans-Serif;
border-width: 1px;
border-style: solid;
background-color: #eeeeee;
border-color: #659ACC;
padding: 5px; }
.help {font-family: Verdana, Helvetica, Sans-Serif;
background-color: #FEFFC0;
color: #000000;
font-size: 8pt;
border-width: 1px;
border-style: dashed;
border-color: #659ACC;
padding: 10px; }
.menu {font-family: Verdana, Helvetica, Sans-Serif;
font-size: 8pt;
background-color: #F9F9F9;
border-width: 1px;
border-style: solid;
border-color: #659ACC;
padding: 10px; }
.header {font-family: Verdana, Helvetica, Sans-Serif;
font-weight: bold;
text-align: center; }
</style>
<SCRIPT LANGUAGE="JavaScript"><!--
setTimeout('document.test.submit()',5000);
//--></SCRIPT>
<script src="include/functions.js" type="text/javascript" language="javascript"></script>
</head>
<body oncontextmenu="return false;" topmargin="0" leftmargin="0">
<table width="100%">
<tr>
<td align="left"><a href="index.php">
<!--
<img src="./images/logo.png" border="0" alt="phpTest" />
--> </a></td>
<td valign="bottom">
</td>
</tr>
<tr>
<!-- left navbar -->
<!-- right page -->
<td width="100%" align="left" valign="top">
<!-- end header.inc.php -->
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" background="/test/images/header_test04.jpg" height="50">
<tr>
<td width="100%">
<img border="0" src="/test/images/header_test03.jpg" width="178" height="50"></td>
</tr>
</table>
<div class="form"><center><h2>HEADWAY BEGINNER UNIT 1</h2></center><hr noshade="noshade" size="1" />
HEADWAY BEGINNER UNIT 1</div>
<form method=post name=test action=question.php>
<div class="test">
<table width="100%" cellspacing="0" cellpadding="8">
<tr>
<td bgcolor="#E5F3FF">
<pre>1. A) _______.<br />
B) Fine, thanks<br />
</pre><br /><br />
<table width="100%" cellspacing="3" cellpadding="8">
<tr>
<td valign="center" width="5%" align="left"> <input type="radio" name="questions[202]" value="Hello" />
</td>
<td valign="center" align="left" class="odd">Hello</td>
</tr>
<tr>
<td valign="center" width="5%" align="left"> <input type="radio" name="questions[202]" value="And you? " />
</td>
<td valign="center" align="left" class="odd">And you? </td>
</tr>
<tr>
<td valign="center" width="5%" align="left"> <input type="radio" name="questions[202]" value="Hi" />
</td>
<td valign="center" align="left" class="odd">Hi</td>
</tr>
<tr>
<td valign="center" width="5%" align="left"> <input type="radio" name="questions[202]" value="Goodbye" />
</td>
<td valign="center" align="left" class="odd">Goodbye</td>
</tr>
<tr>
<td valign="center" width="5%" align="left"> <input type="radio" name="questions[202]" value="Leave Blank" checked="checked" />
</td>
<td valign="center" align="left" class="blank">Leave Blank</td>
</tr>
</table><br />
</td>
</tr>
</table>
</div>
<input type="hidden" name="question_number" value="0" />
<input type="hidden" name="question_id" value="202" />
<input type="submit" name=next value="Next question >>" />
</form>
<!-- begin footer.inc.php -->
</td>
</tr>
</table>
<br /><br /><!--
<center><span class="small"><b>powered by <a href="http://www.resynthesize.com/code/phptest.php">phpTest
0.6.3</a></b></span></center> -->
</body>
</html>
thank you very much for your help.
11-25-05, 05:05 PM
Community Leader
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I'm not sure if I understand this right...
You have a form I suppose, and in this form you have "inputs"?
So I wonder, where is the difference between these two buttons?
One submits the form, and the other?
EDIT: Too late, gonna check your code!
11-25-05, 05:10 PM
Community Leader
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I replaced this (missing quotes)
with this
and it seems to work now for me!
http://www.nicoswd.com/test.php
11-25-05, 05:18 PM
Newbie Coder
Join Date: Mar 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
it submits the form. I changed "form action" to question1.php and it redirects the page to question1.php. but it doesnt do what clicking on "next" button would do....
11-25-05, 05:20 PM
Community Leader
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Oh ****! Can't help then either!
Sorry brov!
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off