Question
The form I try to construct has a layout that depends on search results. The search looks into a specific topic which has nothing but a table, and creates a text entry widget for each row.
In
TopicToSearch:
| row1 |
| row2 |
| row3 |
The form then has:
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* |
| Name | text | 30 | | | M |
%SEARCH{ "^ *\| *.*? *\|" topic="TopicToSearch" web="Main" type="regex" scope="text" multiple="on" nonoise="on" format="| $pattern(^ *\| *(.*?) *\|.*) | text | 1 | 0 | | |" }%
If I look at the topic that defines the form, the search results are substituted and merged into the form properly, as it seems. But if I go to a topic that includes the form I don't see the widgets added by the search.
Environment
--
WilhelmTell - 30 Jun 2008
Answer
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.
yup. Thats a feature I once had in mind for Cairo too, but its not made it thus far. Basically, The
TWikiForm definition does
not evaluate TML statements before parsing the definition table.
its actually related to
TWikiFormInheritance, though there is more to it if you're trying to dynamically set the fields based on a SEARCH.
--
SvenDowideit - 01 Jul 2008
So you're saying that it isn't possible to create forms dynamically, based on search results?
--
WilhelmTell - 02 Jul 2008
I have also found (what seems like) a bug when dynamically setting values of selection widgets for a form. I had a search similar to the one above (with a more appropriate format field though). The search worked when I displayed the table the defined the form, but not when displaying the form at the topics that include the form. Specifically, the values were surrounded by pipes, even though the format field used $pattern() to ignore the table's pipes. I worked it out by double-escaping the pipes (\\| as opposed to \|). The form then displayed the values correctly with the pipes stripped out, but the table defining the form then didn't list any of the values (a compromise I had to accept..).
--
WilhelmTell - 02 Jul 2008
Here is a solution :
- In the "TopicToSearch" topic : use a formated search with his results formated as a one column table beginning with
|*Name*|
- Insert a line in your TWikiForms for the topic you call "TopicToSearch" ;
- Leave the corresponding field called "values" blank in the TWikiForms ..
- Please confirm this did help ..
--
OlivierThompson - 05 Jul 2008