Tags:
create new tag
view all tags

SID-00733: Multiple Values for one Form Field in TWikiForms

Status: Answered Answered TWiki version: 4.2.4 Perl version: Newest
Category: CategoryForms Server OS: Linux (don't know the specs) Last update: 15 years ago

Hi

Firstly if this problem/topic already exist and has been answered I apologize for asking/posting it again. If it does, please point me in the right direction - I can't find it.

Currently in a standard TWikiForm, each row specifies one form field. At the moment one form field can only have, one value or more values, using the +multi term. But then, it's still only one form field with multiple values. Now this is not what I am referring too. (sorry I am having trouble explaining exactly what I want).

Say the Field form name is: "Item1" and it can have a value of "Speaker 400W" or "Speaker 500W" selected via a select box. "Speaker 400W" and "Speaker 500W" are listed in a separate topic, called SpeakerList.

BUT

"Speaker 400W" has a quantity attached to it, namely x2 or x3. It also has a price attached to it, for example 500. If I select "Speaker 400W" I want a second select box with quantities. After I select x2 or x3 I want the third value to be calculated (500 x2 = 1000) or (500 x3 = 1500).

While writing this I figured I could dynamically search the values depending on the previous value selected and then use the AddForm addon to render the table so that the all the related values are in one line.

Is this the best method - and is it at all possible?

Regards Henro Ritchie

-- HenroRitchie - 2010-01-26

Discussion and Answer

If I understand correctly you are looking for a way to have values of a secondary picklist dependent on the value selected on a primary picklist. This does not exist at this time, however we have a project going on to do that. It will be released in the next few weeks. The initial plugin version will allow to have several levels of dependent picklists, but for standalone HTML forms in TWiki pages, not TWikiForms.

-- PeterThoeny - 2010-01-27

Yes you do understand correctly. Ok, will wait for the new update and will try to find an alternative method to work around the problem. I am leaving the question open for now, until I get a workaround, or until the new plugin has been released. Thanks PT.

-- HenroRitchie - 2010-01-27

Just to be sure. Is there a method to use a dynamic variable that has been declared early on in a form, later in the form, without the form first rendering?

-- HenroRitchie - 2010-01-27

You can already build form values dynamically. For example, in a TWikiForms definition page you can have a select where the value is built dynamically by a %SEARCH{}%. For example, the SupportCategory options in the SupportForm (of this support forum) is done dynamically with a search.

-- PeterThoeny - 2010-01-28

Thanks. At the moment I use %SEARCH{}% to get the form values dynamically, but I am talking about something else. What I meant was the following:

For example; in TWikiForms I use %SEARCH{}% to populate Item1's values. Item 1 is a select type. Then I choose one of the options of Item1. Then I use %SEARCH{"%FORMFIELD{"Item1" topic="%TOPIC%"}%......}% to populate the values for Item2 using Item1 as the search string. Item 2 is text type in this case. Item1's values will be listed when I edit the topic with the attached form, but item2's value not, because item1 hasn't been finalized(given a value)(that's how I see it). When I save the topic, Item2 will give me a value that depends on the value of Item1.

As mentioned earlier, you are working on similar project for HTML forms in TWiki.

I have constructed the same form with the help of the From plugin to generate an HTML form. Is there a way to reference Item1 as I did in the TWikiform setup? In other words; what is the HTML form replacement for %FORMFIELD{"Item1" topic="%TOPIC%"}%? and will the HTML form allow me to use Item1 as the search term for Item2 before I submit the HTML form?

Regards Ritchie

-- HenroRitchie - 2010-01-28

I have stumbled on to another problem, or maybe I am too stupid too solve this...

Why won't the following return a value:

%SEARCH{search="$percntCALC{$GET(event)}$percnt" web="Clients" scope="topic" type="regex" order="topic" limit="1" nonoise="on" nototal="on" expandvariables="on" format="$percntCALC{$SET(clientelle, $GET(clientelle) $formfield(Client))}$percnt" separator=" "}%

Where event is declared by the following: %CALC{"$SET(event, $LEFTSTRING(%TOPIC%, 9 ))"}%

Regards Ritchie

-- HenroRitchie - 2010-02-02

-- and is there a way to populate a HTML form dynamically based on selections made earlier in the form? or is that the same thing that PT and the guys are working on?

-- HenroRitchie - 2010-02-02

Yes, that is a plugin we are working on that will be released.

You can't use $percntCALC in a SEARCH string, only in the format parameter. You could try a nested SEARCH where the second search depends on the result of the first SEARCH. See FormattedSearch

-- PeterThoeny - 2010-02-03

Hi PT

Any idea when this plugin will be finished? Is there a way that I can be notified when the plugin is finished? At the moment I will have to stop TWiki implementation due to this issue.

I've tried to find a work around, where I generate a second topic using the first topic information and then searching the webs for the needed info using the formfields from the first topic. This works fine and I can fill all the needed cells.

The problem lies in the fact that I want to calculate the total. For example:

Value 1: Formfield from 1st topic Value 2: Nested search using the search from value 1

This works

Value 3: Value1 * Value2 -- This doesn't work because %CALC % only gets evaluated when the page is saved, at the same time when the search string is evaluated and due to then it gives the wrong answer.

Can I inbed a search string inside a %CALC% function. Something like:

Instead of Value 3: Value1 + Value2 use Value3: Formfield from 1st topic * Nested search using the search from value 1??

Regards Ritchie

-- HenroRitchie - 2010-02-05

IanKluft is working on the HierarchicalSelectPlugin. It is already available in SVN - some bugs need to be fixed.

Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the TWiki consultants if you need timely help. We invite you to get involved with the community, it is more likely you get community support if you support the open source project!

-- PeterThoeny - 2010-04-05

      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 Multiple Values for one Form Field in TWikiForms
SupportCategory CategoryForms
TWiki version 4.2.4
Server OS Linux (don't know the specs)
Web server Apache
Perl version Newest
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2010-04-05 - PeterThoeny
 
  • 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.