SID-02282: Retrieve form data with filed type select+mult
| Status: |
Answered |
TWiki version: |
6.0.1 |
Perl version: |
|
| Category: |
CategoryForms |
Server OS: |
|
Last update: |
9 years ago |
Hello,
I have a twiki form with a name, summary, defect list etc.
DefectList is of type select+multi. This list is dynamic based on user logged in.
I am able to create a topic using form. But I am not able to retrieve data using SEARCH
Defect list is coming out as blank. If I use static list the query works perfectly fine. Here is the syntax I am using
%SEARCH{
"form.name='WeeklyReportForm'" type="query" excludetopic="*Template" nonoise="on" format="$quot$formfield(Name)$quot,$quot$formfield(
DefectsList)$quot,$quot$formfield(Summary)$quot"
}%
Also I am not getting how to modify the form data once topic is created as per template. Modifying the contents of form attached to the topic doesn't update the data in topic.
Any help, examples, or direction on commands to look into would be appreciated.
Thanks
--
TWiki Guest - 2016-12-14
Discussion and Answer
It seems that you, or someone else, has made a couple of experiments in the Sandbox web, which is a good thing, because it shows what you've tried so far. I've used the stuff over there to create a
DefectsListSearch (with a different format) which shows a defects list for all topics which have values in their defects list.
If you want to use the content of form fields in your topic text, then you need to use the
FORMFIELD{} variable in your template instead of
URLPARAM{}:
URLPARAM is expanded
once, when the topic is created (see
TWikiTemplates, whereas
FORMFIELD is left as it is on topic creation, so that it shows the contents of the form "right now". I have changed
ReportTemplate to show both expansions, and created
WeeklyReport00018 to show the new behaviour.
--
Harald Jörg - 2016-12-14
Thank you for explaining difference between FORMFILED and URLPARAM. With that change I am now able to modify the contents of topic containing form.
But other problem still persists for dynamic list. The sandbox example has fixed static list for defects. Suppose I have a dynamic list based on defects assigned to logged in user in Bugzilla then it will vary. With this I am always getting blank list when i do search. If
DefectsList is fixed like in sandbox example it is working fine.
Could you please guide me in solving this problem?
Thanks.
--
TWiki Guest - 2016-12-15
After investigating further I could find the reason for not displaying the multi selected data. Its bugzilla plugin giving hyperlink to defect which is causing problem. If I try with other dynamic data it is working fine. But I dont know how to give new line as seperator than '','' for multi-select options
So how to use %FORMFIELD{"fieldname"}% for select+multi type as new line as a seperator? It will be a great help if you could suggest something.
Thanks.
--
TWiki Guest - 2016-12-15
Sure! Since the result of
%FORMFIELD{}% qualifies as a "list" in TWiki's syntax, you can apply all the list functions of
SpreadSheetPlugin to manipulate the list as desired.
In particular, the functions
$LISTJOIN() and
$LISTEACH() do what you need. I've upgraded
WeeklyReport00018 to show two examples. Note that I've used
%BR% for a "simple" line feed, if you want a new paragraph, use
$n$n as a separator in
$LISTJOIN().
--
Harald Jörg - 2016-12-15
Thanks Harald for your help.
--
TWiki Guest - 2016-12-16
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.