Solved

Refresh having a Form with Post

Posted on 1998-08-19
9
186 Views
Last Modified: 2010-04-09
Hi
I have a html-doc that I want to refresh every n seconds.
I know how to do that whit the
<meta hhtp-equiv="refresh" content="n">
but my problems is that I use a Form with method=post
and then the reader(IE4 or netscape) ask the user
if he want to repost data.
How do I do so the reader doesn't come up with
that window every time.
/Pelle
0
Comment
Question by:PerBoman
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 10

Expert Comment

by:MasseyM
ID: 1836838
Rather than POST use the GET method... You will have the ugly URL string, but the info will not have to be "reposted"
0
 

Author Comment

by:PerBoman
ID: 1836839
I don't want to use GET becuse I have Made a cgi program
on the server that retrive info by the POST command.

 
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1836840
Why don't you write the program to parse the query string and do it that way?  Otherwise, you will always get that message...

0
 
LVL 5

Expert Comment

by:Trevor013097
ID: 1836841
PerBoman,

Matt is right.  You should write your CGI so that it parses whatever you send it and therefore can handle both POSt and GET methods. There are plenty of scripts which are available which will do just that (just look at some of the scripts on Matt's Script Archive under PERL).  The lines needed to do this aren't all the long (about 10 if my memory serves me right).

Your other option if you have to use POST would be to have a Javascript handle the form submission.  Your form would then called a Javascript function onSubmit.  The function would then after a timeout submit your form.  This would then be a resubmission rather than a refresh (ultimately with the same effect) and so IE and NN wouldn't give you the prompt message.

Hope that helps a little.

Trevor.


0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 2

Expert Comment

by:bernfarr
ID: 1836842
Don't forget the data limitation on GET methods. If you have large amounts of data coming in on the form, you must use POST.
0
 
LVL 5

Expert Comment

by:Trevor013097
ID: 1836843
That is very true, which is much of the reason we all started using POST, so maybe the POST method is the better to stick with.  Which means that the Javascript might be the way to go then.

Trevor.


0
 
LVL 5

Accepted Solution

by:
Trevor013097 earned 50 total points
ID: 1836844
PerBoman,

I have written a small script which can resubmit your form without giving the prompt. You can change the amount of time between submits by changing the value (in milliseconds) in the setTimeout line. Here is the script:

<HTML>
<HEAD>
<TITLE>Resubmitting Javascript Form</TITLE>
<SCRIPT LANGUAGE="Javascript">
<!--

function formSubmit() {
  if (document.myForm.stopForm.checked != true) {
      document.myForm.submit();
      setTimeout("formSubmit();", 1000);  // form submits after 1 second (1000 milliseconds)
  }
}

//-->
</SCRIPT>
</HEAD>

<BODY BGCOLOR="#FFFFFF">

<FORM NAME="myForm" METHOD="POST" ACTION="http://www.someserver.com/somescript.pl">
<B>myField1</B> <INPUT TYPE="TEXT" NAME="myField1" SIZE="20"><BR>
<B>myField2</B> <INPUT TYPE="TEXT" NAME="myField2" SIZE="20"><BR>
<B>myField3</B> <INPUT TYPE="TEXT" NAME="myField3" SIZE="20"> <INPUT TYPE="checkbox" NAME="stopForm"> Check box to stop form submitting after this time<BR>
     <INPUT TYPE="BUTTON" NAME="SubmitButton" VALUE="Send the Form" onClick="formSubmit();">
<INPUT TYPE="RESET" NAME="ResetButton" VALUE="Clear the Form">
</FORM>

</BODY>
</HTML>

If you have a problems please let me know.

Trevor.


0
 

Author Comment

by:PerBoman
ID: 1836845
Thank you for telling me about the method form.submit()

0
 
LVL 5

Expert Comment

by:Trevor013097
ID: 1836846
Glad to be of help.

Trevor.


0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now