Feature #7530
Way to define DropDowns in a masterTemplate
| Status: | Rejected | Start date: | 2010-04-29 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | Reinhard Führicht | % Done: | 0% |
|
| Category: | View | |||
| Target version: | Beta 5 (v0.9.8) | |||
| Votes: | 0 |
Description
Hi there,
It would be great, if there would be an easy way to define a whole dropdown in a master template.
History
Updated by Reinhard Führicht about 3 years ago
- Status changed from New to Needs Feedback
- Assignee set to Reinhard Führicht
- Target version set to Beta 5 (v0.9.8)
Could you please be more specific?
You can define a dropdown in the master template. What are your special needs, which are currently not possible?
Updated by Matthias Habegger about 3 years ago
Well, if I wonna define a dropdown for fruits like that
<div class="row">
###error_category###
<label for="category">###LLL:fruit### ###required_fruit###</label>
<select name="formhandler[fruit]" id="fruit">
<option value=""></option>
<optgroup label="-">
<option value="apple" ###selected_fruit_apple###>###LLL:fruit_apple###</option>
<option value="bananas" ###selected_fruit_bananas###>###LLL:fruit_bananas###</option>
<option value="pinapple" ###selected_fruit_pinapple###>###LLL:fruit_pinapple###</option>
</optgroup>
<optgroup label="-">
<option value="miscellaneous" ###selected_fruit_miscellaneous###>###LLL:fruit_miscellaneous###</option>
</optgroup>
</select>
</div>
then I have to write the whole code in my normal template. I didnt find an easier way with my master template, even without the whole optgroup thing.
<!-- ###field_select### -->
<div class="row">
###error_###fieldname######
<label for="###fieldname###">###LLL:###fieldname###### ###required_###fieldname######</label>
<select name="formhandler[###fieldname###]" id="###fieldname###">
...
</select>
</div>
<!-- ###field_select### -->
Maybe there is a way, but I havent seen it.
Updated by Hannes Gesmann about 3 years ago
To create a master template for an <option>, you need it to create the marker ###selected_[fieldname]_[fieldvalue]###.
This is not possible yet, because master templates accept only one parameter (fieldname).
The same problem also applies to checkboxes which need the marker ###checked_[fieldname]_[fieldvalue]###.
Maybe it is possible to extend master templating to accept two kinds of marker:
###field_[masterkey]_[fieldname]###
###field_[masterkey]_[fieldname]_[fieldvalue]###
But this also means that there is no way to have an underscore in a fieldname or -value.
Updated by Reinhard Führicht about 3 years ago
Now I understand the problem.
And you are right, the marker ###field_[masterkey]_[fieldname]_[fieldvalue]### is not an option, because of the problem with underscores in [fieldname] or [fieldvalue].
But it would be possible to do it this way:
###field_[fieldname]:[value1]:[value2]###
In the subpart in the master template you could then use the markers ###value1### and ###value2### and formhander will replace the with the given values.
What do you think?
Updated by Matthias Habegger about 3 years ago
Well, the problem is that when I define a mastertemplate I dont know, how many values there would be maybe 3 maybe 100.
I think, it would be a nice thing, if the problem could handle it be itself.
Updated by Reinhard Führicht almost 3 years ago
- Status changed from Needs Feedback to Rejected
Nobody knows how to achieve the desired goal... including me.
So I will reject this feature for now.
If you have a variable count of items in a dropdown, you can use TypoScript or a user function to put the options in.
If the count is fixed, you can write it to the master template without any problems.
So, I don't see an urge to work on this one. It is more important for me to get 0.9.8 and a 1.0.0 stable release into TER.