471,351 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,351 software developers and data experts.

I need to create a form on the fly

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

May 3 '06 #1
5 2356

Lee wrote:
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

May 3 '06 #2

Phil Powell wrote:
Lee wrote:
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

May 3 '06 #3
ASM
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) ?
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

--
Stephane Moriaux et son [moins] vieux Mac
May 4 '06 #4

ASM wrote:
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);
}
</script>
Nothing happens, no alert is spawned, nothing at all. No errors of any
kind.

Phil
--
Stephane Moriaux et son [moins] vieux Mac


May 4 '06 #5

Phil Powell wrote:
ASM wrote:
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);
}
</script>


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

Phil
--
Stephane Moriaux et son [moins] vieux Mac

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

May 4 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Mike Button | last post: by
7 posts views Thread by Jack Addington | last post: by
reply views Thread by ward | last post: by
13 posts views Thread by PinkBishop | last post: by
4 posts views Thread by access baby | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.