Tags:
create new tag
view all tags

SID-01153: How can I save a javascript generated table to the Topic

Status: Answered Answered TWiki version: 4.2.3 Perl version: 5.005, 5.6.1
Category: CategoryJavaScript Server OS: RedHat Linux 7.5, kernel 2.7.3 Last update: 14 years ago

Hello, I am trying to create an input form for bad parts summaries. I have used javascript to generate something that works on the Topic, but I can't get it to save. There is a small input form that asks the user for the amount of parts they would like to enter, and an entry table is then generated with the amount of rows equal to the amount of parts they would like to enter. The user enters each row's info, and then submits. The entries post to seperate tables based on one of the input fields. I have been messing around with the comment plugin to try to get it to save each table so I can then include the lines of each table on a specific page, but I can't figure out how to save each table. Is there a way to save a table generated with javascript, and based on user entries? Thank you, Josh

-- JoshuaTatman - 2011-04-25

Discussion and Answer

There are ways to submit two form actions with one user submit using Javascript.

Also, not sure if relevant, but see SID-00833.

-- PeterThoeny - 2011-04-27

The link is relevant, but I am having trouble getting the example to work:

No need for Ajax, create an HTML form that calls the save script on the other topic. Here is an untested example, assuming topic OtherTopic having a form called "Title": <form action="%SCRIPTURL{save}%/%WEB%/OtherTopic" method="post"> Title: <input type="text" name="Title" size="50" value="" class="twikiInputField" /> <input type="submit" value="Submit" class="twikiSubmit" /> </form>

I made an HTML form named "Title" on OtherTopic, but I could not change the content to what I was entering into the text input.

-- JoshuaTatman - 2011-04-28

An HTML form won't work. You need to define a TWiki Form and attach it to OtherTopic. See how-to at Blog.BlogEntry201009x1.

-- PeterThoeny - 2011-04-28

Thank you, but I am still a little confused. How does it know which field to update if there were more than one?

-- JoshuaTatman - 2011-04-29

By the form field name. In above example you send a URL parameter named Title. If there is a TWiki Form field of the same name, the save script will update that TWiki Form field. You can pass along as many fields as you like.

-- PeterThoeny - 2011-04-29

Thank you, I got that to work. But I think I am going to need to find a different way to do this. Can the Comment Template Output definition use the SpreadSheet Plugin to create conditional output?

-- JoshuaTatman - 2011-04-29

SpreadSheetPlugin might not work due to it's special variable eval order. Try using VarIF - see also IfStatements.

-- PeterThoeny - 2011-04-30

Sounds Good, Thank you.

-- JoshuaTatman - 2011-05-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.
SupportForm
Status Answered
Title How can I save a javascript generated table to the Topic
SupportCategory CategoryJavaScript
TWiki version 4.2.3
Server OS RedHat Linux 7.5, kernel 2.7.3
Web server Apache 3.0.99-563
Perl version 5.005, 5.6.1
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2011-05-03 - JoshuaTatman
 
  • 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.