[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Infinite Form does not refresh

Posted on 2000-03-07
6
Medium Priority
?
209 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 16

Accepted Solution

by:
maneshr earned 40 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

656 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