Solved

Refresh having a Form with Post

Posted on 1998-08-19
9
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

734 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