create new tag
, view all tags

SID-02331: Use a form to update a webpage

Status: Answered Answered TWiki version: Perl version:
Category: CategoryForms Server OS: Last update: 6 months ago


I'm trying to figure out how to write a user form that will send an update to another webpage in TWiki. Ideally, this will be something that people without admin access will be able to do.

I created a form (ProxyUpdateForm)

Name Type Size Values Tooltip message
Date date 16   Expiry Date
Time text 16   Expiry Time
Shifter text 16   User
Updated text 36   Time of Last Update

And I have a webpage (TestProxyUpdate) where I would like people to fill out the form:

Update Proxy Expiration Date and Time

%EDITFORMFIELD{ "ProxyUpdateForm" type="start" action="view" method="post" }%
| Date | %EDITFORMFIELD{ "Date" type="date" form="ProxyUpdateForm" }% |
| Time | %EDITFORMFIELD{ "Time" type="text" form="ProxyUpdateForm" placeholder="hh:mm:ss" }% |
| Shifter | %EDITFORMFIELD{ "Shifter" type="text" form="ProxyUpdateForm" placeholder="Shifter Name" }% |
| | %EDITFORMFIELD{ "form" type="submit" value="Update" }% |
%EDITFORMFIELD{ "Updated" type="hidden" value="%SERVERTIME{$year-$mo-$day}%" }%
%EDITFORMFIELD{ "form" type="end" }%

** I'm not sure what the update button will do? How do I make it save the values input into the form??

Lastly I have a webpage that I want the values in the form to be pushed to when the "Update" button is pressed:

Proxy Expiry:

The Proxy will expire on : *search for form values here (date and time) Proxy updated by: *search for form values here (shifter)

Expiration updated on: *search for form values here (updated)

To update proxy details: TestProxyUpdate

I'm not sure what the correct syntax is to just get the variables I want.

Any help I could get would be very much appreciated. Thanks, Karin

-- TWiki Guest - 2017-09-20

Discussion and Answer

A good place to start is blog How to Create a TWiki Application.

Your form action is the TWiki save script. You need to either ask the user for a topic name, or add a hidden form field for an auto-generated topic name. The idea is that on each submit, a new topic is created with the ProxyUpdateForm containing the values of the user input.

-- Peter Thoeny - 2017-09-28

Hi Peter,

The blog shows exactly what I would like to do! however, any time I hit Update it makes a copy of the sandbox home (Sandbox/WebHome) page and makes it a child of the main page without updating anything. I tried copying and pasting ContactDB into my sandbox with ContactForm, ContactHeader, ContactTemplate, and NewContact, but the same behavior occurred where the table would not update and hitting "Create New Contact" on the ContactDB page redirected me to Sandbox/WebHome. Do you have an idea why this might be happening? Am I missing some sort of plugin? Thanks, Karin

-- TWiki Guest - 2017-10-02

I got it to work! (not the contact example, but my stuff). I'm not sure what I did exactly, but here is the key part (my "NewProxy") ProxyUpdateMainPage is the master page that the form will update to ProxyTemplate is the template page that contains a ProxyForm with Date, Time, and Shifter fields

%EDITFORMFIELD{"form" name="new" type="start" action="save" topic="LongTermProxyUpdate%SERVERTIME{$yearx$mox$day}%" method="post" }% %EDITFORMFIELD{"templatetopic" type="hidden" value="ProxyTemplate"}% %EDITFORMFIELD{"topicparent" type="hidden" value="ProxyUpdateMainPage" }%

Date %EDITFORMFIELD{ "Date" type="date" }%
Time %EDITFORMFIELD{ "Time" type="text" placeholder="hh:mm:ss" }%
Shifter %EDITFORMFIELD{ "Shifter" type="text" placeholder="Shifter Name" }%
  %EDITFORMFIELD{ "form" type="submit" class="twikiSubmit" value="Update" }%
%EDITFORMFIELD{"form" type="end" }%

Begin able to look at your example was very helpful. Thanks, Karin

-- TWiki Guest - 2017-10-03

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Status Answered
Title Use a form to update a webpage
SupportCategory CategoryForms
TWiki version

Server OS

Web server

Perl version

Browser & version

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2017-10-03 - TWikiGuest
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.