Tags:
create new tag
view all tags

Question

I've got a topic that allows users to auto-generate a new topic with a standard name and template form values populated, based on user input in the form of text fields and checkboxes. While the name is generated as should be I am having trouble passing checkbox values if more than one box is ticked.

For example, a user can select one or more DB types (Ora, Syb or MS). The form attached to the generated topic should have each of the respective DB type checkboxes checked. This currently only works for the last DB type checked. I.e. If user selects Syb then Ora, a topic is generated with Ora only selected.

After extensive reading in Support Web and TWikiForms, I've found several references to this instruction from TWikiForms, but no further elaboration:

"Additionally a new topic can be given a Form using the formtemplate parameter in the URL. Initial values can then be provided in the URLs or as form values:

  • other than checkboxes: name, ex: ?BugPriority=1
  • checkbox: namevalue=1, ex: ?ColorRed=1.
Boxes with a tick must be specified"

To illustrate what I am trying to do, I can specify multiple checkbox values and pass to generated template form like this:

<input type="hidden" name="DbType" value="Ora" />
<input type="hidden" name="DbType" value="Syb" />

Doing this dynamically with values passed from the Javascript overwrite the previous DbType value. As per above instruction, I've tried using the checkbox name/value combo and assigning it to 1. The instruction does not specify where to do this (within name or value attribute), but I've tried a number of variations, including following:

<input type="hidden" DbTypeOra="1" />
<input type="hidden" DbTypeSyb="1" />
or
<input type="hidden" name="DbType" Ora="1" />
<input type="hidden" name="DbType" Syb="1" />
or
<input type="hidden" name="?DbTypeDbOra" value="1" />
<input type="hidden" name="?DbTypeDbSyb" value="1" />

(note: This example is simplified. I am actually passing in values based on a Javascript checks and this is working, as long as the check returns only 1 value.)

Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Forms

-- MichelleAlbertin - 18 Sep 2006

Answer

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.

Yes, the instructions could be more explicit. This should work:

<input type="hidden" name="DbTypeOra" value="1" />
<input type="hidden" name="DbTypeSyb" value="1" />

which produces parameters of form: ?DbTypeOra=1;DbTypeSyb=1

-- PeterThoeny - 19 Sep 2006

Thanks for clarifying the syntax, unfortunately it still does not work. Having reduced my example, here's what I have:

<form name="dbms" action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%" />
<input type="hidden" name="topic" value="TestTopic8" />
<input type="hidden" name="DocType" value="StandardsPolicies" />
<input type="hidden" name="DbTypeOra" value="1" />
<input type="hidden" name="onlywikiname" value="on" />
<input type="hidden" name="templatetopic" value="%TOPIC%Template" />
<input type="submit" value="Create New Document"  / >
</form>
And here is the form template attached to the new topic:
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* |
| DbType | checkbox | 3 | Ora, Syb, Ms |  |
| DocType | checkbox | 10 | BuildDoc, HowTo, StandardsPolicies, ToolsVendors, IncludedDoc, MainTopic, SiteMenu, ErrorResolution, PremiumService, Faq | |

I cannot seem to get even one DbType passed. Am I missing something? PeterThoeny emphasized should work in his post. Are there cases where it clearly would not?

I also tried following with no luck:

[[%SCRIPTURL%/edit%SCRIPTSUFFIX%/%WEB%?topic=TestTopic9&templatetopic=%TOPIC%Template&DbTypeOra=1][Click here]] 

-- MichelleAlbertin - 19 Sep 2006

Any other ideas? Without a solution, I will need to re-think the entire process even though documentation seems to indicate this one should work. Thanks.

-- MichelleAlbertin - 26 Sep 2006

I ended up doing this with a javascript that determined which of the DBMS choices were selected and creating a new form element on the fly for each, with the relevant form value. Passing multiple checkbox values to a form in another topic doesn't seem to be an issue, as long as you can hard-code the values within a corresponding element.

-- MichelleAlbertin - 13 Oct 2006

Change status to:
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2006-10-13 - MichelleAlbertin
 
  • 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.