[TYPO3-commerce] Key value decoupling in pi3: getSelectInputField

David Toshack david at vaultin.com
Thu Nov 1 15:16:21 CET 2007




Michiel Roos [netcreators] wrote:
> 
> foreach ($fieldConfig['values'] as $option) {
>    $result .= '<option name="' .$option .'" value="' .$option .'"';
>    if ($fieldValue === $option)
>      $result .= ' selected="selected"';
>    $result .= '>' .$option .'</option>' ."\n";
> }
> 
> Should become:
> 
> foreach ($fieldConfig['values'] as $key => $value) {
>    $result .= '<option name="' .$value .'" value="' .$key .'"';
>    if ($fieldValue === $key)
>      $result .= ' selected="selected"';
>    $result .= '>' .$option .'</option>' ."\n";
> }
> 
> Any strong arguments against this change?
> 

Not at all, that would be excellent!

One thing though. I had to change fieldConfig['values'] to
fieldConfig['values.'] ... which I would assume would be the same for your
changes. Either that or use the parseFieldList function.

Or am I doing something wrong with my TS?
my TS for the actual values are set like this:

  plugin.tx_commerce_pi3.billing.sourceFields.mySelectFieldName.values {
    1 = 
    2 = Item 1
    3 = Item 2
    4 = Item 3
    5 = Item 4
  }

I had to leave the first item blank to receive the mandatory blank warning.
Not ideal, but it works.

How would mandatory fields be handled with the new key/value method?

Sorry to hijack the thread, but another point that is related, if the
fe_users' title field is used, rather than the general_title value from the
locallang value, billing_title is used, containing "Billing address". Maybe
the step title should be renamed to something not in the list of likely
fields to be used.


Cheers,
David

-- 
View this message in context: http://www.nabble.com/Key-value-decoupling-in-pi3%3A-getSelectInputField-tf4612523.html#a13529569
Sent from the TYPO3 - Projects - Commerce mailing list archive at Nabble.com.



More information about the TYPO3-project-commerce mailing list