Ticket #148 (closed enhancement: fixed)
Add values to enum additional to datasource
| Reported by: | frank.kleine@… | Owned by: | argh@… |
|---|---|---|---|
| Priority: | highest | Milestone: | v0.9.0 stable |
| Component: | Element | Version: | current-cvs |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by schst) (diff)
If you write something like <patForms:Enum name="new_provider" style="width: 100%;">
<patForms:Option value="" label="Please choose..." /> <patForms:Datasource type="callback" method="getProviderList"
class="DataSource?"/> </patForms:Enum>
in your form template the first option is ignored and just the values from the datasource will be in the final form. Sometimes you would like to have an additional "Please choose" option in your form element, but the data source isn't the right place to put this additional value into. So it would be better to merge those predefined values with those from the datasource.
The simpliest solution would be $values = array_merge($this->attributesvalues?, $values); after retrieving the values from the datasource. This would prepend all values defined in the template to the datasource value, regardless if they were defined before or after the datasource element within the template.

Done, available in CVS.