yssirhc
05-05-2009, 11:16 AM
I have a cgi web page that displays some info and then has a form on the bottom for you to comment on that info.
The problem I'm having is that after the user submits a comment from that form, the browser displays a whole new web page. What I want it to do is refresh the page the user is on (the one with the form on it) and display some sort of message all on that same page. Either by having the message displayed somewhere on the form page itself or by having a popup window come up.
I've tried doing it with javascript:
<input type="submit" name="commentButton" value="Submit Comment" onclick="alert('Your comments have been submitted. Thank you for your feedback.'); location.reload();">
But the onclick happens before the submit, so refreshing the page there doesn't really work - it doesn't show the new info. And after hitting submit I just get a blank web page.
Is there any way to do this within my perl script instead, after it does all the form processing?
The problem I'm having is that after the user submits a comment from that form, the browser displays a whole new web page. What I want it to do is refresh the page the user is on (the one with the form on it) and display some sort of message all on that same page. Either by having the message displayed somewhere on the form page itself or by having a popup window come up.
I've tried doing it with javascript:
<input type="submit" name="commentButton" value="Submit Comment" onclick="alert('Your comments have been submitted. Thank you for your feedback.'); location.reload();">
But the onclick happens before the submit, so refreshing the page there doesn't really work - it doesn't show the new info. And after hitting submit I just get a blank web page.
Is there any way to do this within my perl script instead, after it does all the form processing?