Tags:
create new tag
, view all tags

Question

Hi,

This may be more of a programming question than of Twiki. I have this code to generate a page for user input.

<form name="testform" action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%" method="post">
Your input: <input type="text" name="test" />
<input type="submit" class="twikiSubmit" value="Submit" />
</form>

You entered %URLPARAM{"test"}%

... as given below:

Your input:

You entered **

After submitting the form, the URLPARAM value is not cleared automatically and hence if the user refreshes the screen, the input is posted again. The is creating problems for me (the entry goes into the database again, in the application I am trying to create).

Is there an easy way (for a non-programmer) to clear the value once it is posted ?

Environment

TWiki version: unspecified
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows 2003
Web server: Apache
Perl version:  
Client OS:  
Web Browser:  
Categories: Forms

-- ChengappaCB - 20 Dec 2008

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Your form action could point to an intermediary page that does the desired action, then redirects back to the originating page.

-- PeterThoeny - 21 Dec 2008

You could also make a hidden input field (<input "name="SubmittedOrNot" type="hidden" value="no" ..) in your form, and set it to "submitted" when the user submits the form. And in the OnClick event of the submit button, you could send it to a small javascript function that checks to see the value of that hidden field; and if it's "submitted" then it does not process the form. If it's "no" then it will continue submitting the form (and set the value of that hidden input field to "submitted"). This would require only a little bit of scripting -- you could probably find some samples online!

-- KathyDeLaCruz - 22 Dec 2008

Good suggestion; closing this question...

-- PeterThoeny - 29 Dec 2008

 
Change status to:
Topic revision: r4 - 2008-12-29 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.