jithint has asked for the wisdom of the Perl Monks concerning the following question:

The Problem: I have a webpage with two frames - left_frame and right_frame. The left frame is used to submit feedback. It has text boxes for name and email address, a textarea for the actual feedback and a Submit button. On clicking Submit button the feedback is saved to a file. right_frame is used to read this file and display the feedback.

Now this is what I want to do: Every time a user enters his feedback and clicks on Submit button, the feedback should be saved to the file and at the same time the right frame should refresh to display the old feedback + the one submitted just now. How do I do this???

Replies are listed 'Best First'.
Re: Refreshing frame on submit
by Anonymous Monk on Jan 19, 2010 at 08:35 UTC
Re: Refreshing frame on submit
by Unforgiven (Hermit) on Jan 19, 2010 at 13:56 UTC

    I think I'd have two scripts: save_form.cgi and load_message.cgi. You submit your form and it goes to save_form.cgi, which saves the data. save_form.cgi returns a simple page that just says "message saved" or whatever, and has a bit of javascript that changes the right_frame's location to something like "load_message.cgi?id=1234", where 1234 is the recently submitted message's identifier. Then just have load_message.cgi read the thing they just posted, and display it.

    I should warn you though, I'm a little sleep deprived from being sick lately, so there's probably easier/better ways to do it. That was just my initial reaction to it

      Thanks for the reply. Isn't it possible to do it using only CGI/Perl. Right now I'm using a cgi script to save the feedback to a file and at the end of the save operation I redirect to left_frame, so that after submitting the feedback form is displayed again.