Solved

Infinite Form does not refresh

Posted on 2000-03-07
6
207 Views
Last Modified: 2013-12-25
I am using a perl cgi script that does basically this:

main
{
    if (param)
   {
        process_form();
   }
    else
   {
        print_form();  
   }
}

At the end of process_form(), there is a call to print_form(), so that
I am basically having an infinite "form loop".

process_form() updates an INI file, in which there is a parameter read and
printed on the page by print_form().

So, let's say that I have submitted the first time and that this INI file
is updated.
I actually see that the parameter is changed when print_form() prints
the page: this is fine.

The problem is: print_form() also sets the default values of the form entries
by reading from this same updated INI, but the changes do not appear on
the newly displayed page.
To make them appear, I have to reload the page completely ("completely" means: not a straight reload, because there is this well-known Repost From Data box that pops up - I need to reopen the document by typing the URL, and THEN reoad by pressing the refresh button).

I tried to include a Javascript document.reload() function at the onSubmit event, but it did not help.

Does anybody have some advice to solve this problem?

Is the only solution to have the process_form() function write a second
page, this page having a Meta-Refresh tag to reload the first document?

Thanks for any hint!
0
Comment
Question by:gaggio
[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
  • 3
  • 3
6 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 2596164
i would suggest restructuring your program as follows...


main {

  if (param){
    process_form();
  }
   print_form();  

}

That way for the 1st time ONLY the form is printed. Every time after that the process_form is done & then the form is printed.

Additionally, add the following META tag in the HTML HEAD tag.

 <HEAD>
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="expires" content="0">
  </HEAD>


Although this is not totally reliable (some problems in IE) it might still help you in a lot of other cases.
0
 
LVL 1

Author Comment

by:gaggio
ID: 2596494
Thanks for your help.

I tried exactly what you said, but it
does not help. Moreover, it writes
the form a second time below the first
form, so that you end up with an infinite number of forms!
(and the second form is exactly the same as the first one: it is NOT updated)

0
 
LVL 16

Expert Comment

by:maneshr
ID: 2596754
are you calling print_form from within process_form??

if so then you need to remove it from process_form.

0
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
LVL 16

Accepted Solution

by:
maneshr earned 20 total points
ID: 2596778
can you send your exact code to this forum?

it will help a lot, Thanks
0
 
LVL 1

Author Comment

by:gaggio
ID: 2596954
Thanks, maneshr
Yes, I was still calling it from
within print_form()
But I found a way to fix the problem:
instead of assigning the values to the
form entries while printing them
(e.g print textfield("myname","myvalue"), I do: param("name","value") right before printing,
and replace the print by print textfield("name").

This fixes the problem completely!
0
 
LVL 1

Author Comment

by:gaggio
ID: 2596972
I'm pretty sure that by removing the print_form() call from process_form(), it would not have solved the problem, because without removing it I was getting twice the EXACT SAME form: no update at all!

Ok, but you deserve the points, since you were the only person replying to me, and I want to close the question right now.

Thanks for trying to help
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

724 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