I need to create a form on the fly

P

Phil Powell

Requirement is to refresh a page in the form of a continual form
submittal (for server-side validation and action)

Here is the Javascript I came up with that I thought would do that:

<script type="text/javascript">
function generateForm() {
document.forms[0].elements[0].name = 'username';
document.forms[0].elements[0].type = 'hidden';
document.forms[0].elements[0].value = 'ppowell'
document.forms[0].elements[1].name = 'hasSubmittedLogin';
document.forms[0].elements[1].type = 'hidden';
document.forms[0].elements[1].value = '1'
document.forms[0].elements[2].name = 'id';
document.forms[0].elements[2].type = 'hidden';
document.forms[0].elements[2].value = '144'
document.forms[0].elements[3].name = 'submit';
document.forms[0].elements[3].type = 'hidden';
document.forms[0].elements[3].value = 'Login to view required forms'
document.forms[0].action = '/student/formlist.php';
document.forms[0].submit();
}

self.setTimeout('generateForm', 8000);
</script>

I keep getting the same error in both Firefox (Linux) and Konqueror:

document.forms[0] has no properties

Is there a way to refresh a page automatically causing continual form
auto-submit, required for continual server-side activity?

Thanx
Phil
 
L

Lee

Phil Powell said:
Requirement is to refresh a page in the form of a continual form
submittal (for server-side validation and action)

Here is the Javascript I came up with that I thought would do that:

<script type="text/javascript">
function generateForm() {
document.forms[0].elements[0].name = 'username';
document.forms[0].elements[0].type = 'hidden';
document.forms[0].elements[0].value = 'ppowell'
document.forms[0].elements[1].name = 'hasSubmittedLogin';
document.forms[0].elements[1].type = 'hidden';
document.forms[0].elements[1].value = '1'
document.forms[0].elements[2].name = 'id';
document.forms[0].elements[2].type = 'hidden';
document.forms[0].elements[2].value = '144'
document.forms[0].elements[3].name = 'submit';
document.forms[0].elements[3].type = 'hidden';
document.forms[0].elements[3].value = 'Login to view required forms'
document.forms[0].action = '/student/formlist.php';
document.forms[0].submit();
}

self.setTimeout('generateForm', 8000);
</script>

I keep getting the same error in both Firefox (Linux) and Konqueror:

document.forms[0] has no properties

Is there a way to refresh a page automatically causing continual form
auto-submit, required for continual server-side activity?

When you submit a form, the server sends back a new page.
Just have it send back the form, instead of creating it in script.


--
 
P

Phil Powell

Lee said:
Phil Powell said:
Requirement is to refresh a page in the form of a continual form
submittal (for server-side validation and action)

Here is the Javascript I came up with that I thought would do that:

<script type="text/javascript">
function generateForm() {
document.forms[0].elements[0].name = 'username';
document.forms[0].elements[0].type = 'hidden';
document.forms[0].elements[0].value = 'ppowell'
document.forms[0].elements[1].name = 'hasSubmittedLogin';
document.forms[0].elements[1].type = 'hidden';
document.forms[0].elements[1].value = '1'
document.forms[0].elements[2].name = 'id';
document.forms[0].elements[2].type = 'hidden';
document.forms[0].elements[2].value = '144'
document.forms[0].elements[3].name = 'submit';
document.forms[0].elements[3].type = 'hidden';
document.forms[0].elements[3].value = 'Login to view required forms'
document.forms[0].action = '/student/formlist.php';
document.forms[0].submit();
}

self.setTimeout('generateForm', 8000);
</script>

I keep getting the same error in both Firefox (Linux) and Konqueror:

document.forms[0] has no properties

Is there a way to refresh a page automatically causing continual form
auto-submit, required for continual server-side activity?

When you submit a form, the server sends back a new page.
Just have it send back the form, instead of creating it in script.


--

This is the closest I could get to what you were talking about:

<form name="manualResetForm" method="POST"
action="/student/formlist.php">
<input type="hidden" name="username" value="ppowell">
<input type="hidden" name="hasSubmittedLogin" value="1">

<input type="hidden" name="id" value="144">
<input type="hidden" name="submit" value="Login to view required
forms">

<script type="text/javascript">
self.setTimeout('document.manualResetForm.submit', 8000);
</script>
<noscript>

Due to security constraints, once you click to view/download any of the
above-referenced forms, you must <input type="submit" name="submit"
value="click here"> before you are able to view/download any other
above-referenced form<br><br>
</noscript>

This never auto-submits the form and thus refreshes the page via FORM
post.

Phil
 
P

Phil Powell

Phil said:
Lee said:
Phil Powell said:
Requirement is to refresh a page in the form of a continual form
submittal (for server-side validation and action)

Here is the Javascript I came up with that I thought would do that:

<script type="text/javascript">
function generateForm() {
document.forms[0].elements[0].name = 'username';
document.forms[0].elements[0].type = 'hidden';
document.forms[0].elements[0].value = 'ppowell'
document.forms[0].elements[1].name = 'hasSubmittedLogin';
document.forms[0].elements[1].type = 'hidden';
document.forms[0].elements[1].value = '1'
document.forms[0].elements[2].name = 'id';
document.forms[0].elements[2].type = 'hidden';
document.forms[0].elements[2].value = '144'
document.forms[0].elements[3].name = 'submit';
document.forms[0].elements[3].type = 'hidden';
document.forms[0].elements[3].value = 'Login to view required forms'
document.forms[0].action = '/student/formlist.php';
document.forms[0].submit();
}

self.setTimeout('generateForm', 8000);
</script>

I keep getting the same error in both Firefox (Linux) and Konqueror:

document.forms[0] has no properties

Is there a way to refresh a page automatically causing continual form
auto-submit, required for continual server-side activity?

When you submit a form, the server sends back a new page.
Just have it send back the form, instead of creating it in script.


--

This is the closest I could get to what you were talking about:

<form name="manualResetForm" method="POST"
action="/student/formlist.php">
<input type="hidden" name="username" value="ppowell">
<input type="hidden" name="hasSubmittedLogin" value="1">

<input type="hidden" name="id" value="144">
<input type="hidden" name="submit" value="Login to view required
forms">

<script type="text/javascript">
self.setTimeout('document.manualResetForm.submit', 8000);
</script>
<noscript>

Due to security constraints, once you click to view/download any of the
above-referenced forms, you must <input type="submit" name="submit"
value="click here"> before you are able to view/download any other
above-referenced form<br><br>
</noscript>

This never auto-submits the form and thus refreshes the page via FORM
post.

Phil

I managed to redesign it, however, nothing happens upon <body
onLoad="manualReset()">

<script type="text/javascript">
<!--

function manualReset() {
self.setTimeout('document.manualResetForm.submit', 800);
}

//-->
</script>

However, absolutely nothing happens and I can't seem to figure out why
at this point.

Phil
 
A

ASM

Phil Powell a écrit :
Lee said:
Phil Powell said:
I keep getting the same error in both Firefox (Linux) and Konqueror:

document.forms[0] has no properties

did your page have a form (even empty) ?
This is the closest I could get to what you were talking about:

<form name="manualResetForm" method="POST"
action="/student/formlist.php">
<input type="hidden" name="username" value="ppowell">
<input type="hidden" name="hasSubmittedLogin" value="1">

<input type="hidden" name="id" value="144">
<input type="hidden" name="submit" value="Login to view required
forms">

<script type="text/javascript">
self.setTimeout('document.manualResetForm.submit', 8000);

setTimeout('document.forms[\'manualResetForm\'].submit()', 8000);
This never auto-submits the form and thus refreshes the page via FORM
post.

Yes, that would have to submit to your formlist.php
 
P

Phil Powell

ASM said:
Phil Powell a écrit :
Lee said:
Phil Powell said:

I keep getting the same error in both Firefox (Linux) and Konqueror:

document.forms[0] has no properties

did your page have a form (even empty) ?

Yes. The original as well as the generated formlist.php has a form at
all times, verified via alert(document.manualResetForm);

This is the closest I could get to what you were talking about:

<form name="manualResetForm" method="POST"
action="/student/formlist.php">
<input type="hidden" name="username" value="ppowell">
<input type="hidden" name="hasSubmittedLogin" value="1">

<input type="hidden" name="id" value="144">
<input type="hidden" name="submit" value="Login to view required
forms">

<script type="text/javascript">
self.setTimeout('document.manualResetForm.submit', 8000);

setTimeout('document.forms[\'manualResetForm\'].submit()', 8000);
This never auto-submits the form and thus refreshes the page via FORM
post.

Yes, that would have to submit to your formlist.php

It doesn't do that, and it's supposed to do that.

CODE:

<script type="text/javascript">
function autosubmit() {
alert(document.forms[0]);
document.manualResetForm.submit();
}

function manualReset() {
self.setTimeout('autosubmit', 800);
}

Nothing happens, no alert is spawned, nothing at all. No errors of any
kind.

Phil
 
P

Phil Powell

Phil said:
ASM said:
Phil Powell a écrit :
Lee wrote:

Phil Powell said:

I keep getting the same error in both Firefox (Linux) and Konqueror:

document.forms[0] has no properties

did your page have a form (even empty) ?

Yes. The original as well as the generated formlist.php has a form at
all times, verified via alert(document.manualResetForm);

Is there a way to refresh a page automatically causing continual form
auto-submit, required for continual server-side activity?

When you submit a form, the server sends back a new page.
Just have it send back the form, instead of creating it in script.


--


This is the closest I could get to what you were talking about:

<form name="manualResetForm" method="POST"
action="/student/formlist.php">
<input type="hidden" name="username" value="ppowell">
<input type="hidden" name="hasSubmittedLogin" value="1">

<input type="hidden" name="id" value="144">
<input type="hidden" name="submit" value="Login to view required
forms">

<script type="text/javascript">
self.setTimeout('document.manualResetForm.submit', 8000);

setTimeout('document.forms[\'manualResetForm\'].submit()', 8000);
This never auto-submits the form and thus refreshes the page via FORM
post.

Yes, that would have to submit to your formlist.php

It doesn't do that, and it's supposed to do that.

CODE:

<script type="text/javascript">
function autosubmit() {
alert(document.forms[0]);
document.manualResetForm.submit();
}

function manualReset() {
self.setTimeout('autosubmit', 800);
}

Nothing happens, no alert is spawned, nothing at all. No errors of any
kind.

Phil


GOT IT!

<script type="text/javascript">
<!--

function autosubmit() {
document.manualResetForm.submit();
}

function manualReset() {
self.setTimeout('autosubmit()', 15000);
}

//-->
</script>

Basically I just plain guessed it as all of the Google references I
found apparently were syntactically wrong for what I needed to do!

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top