Ticket #148 (closed enhancement: fixed)

Opened 8 years ago

Last modified 8 years ago

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.

Change History

comment:1 Changed 8 years ago by argh@…

  • Status changed from new to closed
  • Resolution set to fixed

Done, available in CVS.

comment:2 Changed 8 years ago by schst

  • Description modified (diff)
  • Milestone set to v0.9.0 stable
Note: See TracTickets for help on using tickets.