Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Refresh having a Form with Post

Posted on 1998-08-19
9
Medium Priority
?
235 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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 …

824 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