Question
Registration Select Field from Category Entries
Hi,
TWikiForms allow me to create pick lists from which a field entry can take a value. This pick list is explictly stated in the form definition. The
TWikiRegistrationForm allows me to create a pick list if I define it in the HTML definition of that form.
In both cases I have a requirement where valid values for entries in that field should be those that are of a certain category in another web. Example:
TWikiRegistration allows someone to type in a city, but I would rather they select a city, where all cities are defined as topics (of a given type) in a given web.
- How do I do this in the registration form?
- How do I do this in TWikiForms?
- Is there any plan to converge the mechanisms used by these two or are they ideologically distinct? If so, what's the distinction?
- TWiki version: Feb 03
- Perl version: Perl 5.8
- Web server & version: Apache
- Server OS: Redhat Linux
- Web browser & version: IE 6
- Client OS: XP Pro
--
MartinCleaver - 15 Apr 2003
Answer
If I understand you right, you are trying to dynamically generate the possible values for a field based on a search. The patch at
DynamicFormOptionDefinitions will do that, if the search is in a separate topic, but see my caveat at the bottom.
Using this patch, you could define yourself a topic, say
IterationSearch, as follows:
| *Name* | *Type* | *Tooltip message* |
| | | |
%SEARCH{"Iteration" scope="topic" nototal="on" nosummary="on" nosearch="on" format="| $topic | option | |"}%
which would generate you a list of values for a field in your form defined as
| [[IterationSearch][Submitted by]] | select | 1 | | |
(note the trick added by
PeterKlausner to get a nice field title in the form). If you don't want to add extra values at the top of your table, you could just define the header as part of the search.
--
ThomasWeigert - 20 Apr 2003
The registration page has a static form. You can replace the edit field for the city with an embedded
FormattedSearch that creates a select tag based on other topics (or an INCLUDE with a regex pattern to grab it from another page). With the latest
SpreadSheetPlugin you can also do substitutions to change e.g. a comma list into an option list.
--
PeterThoeny - 27 Jul 2003