Bug #3657

<f:form.select does not allow to specify selectedValue

Added by Marcel Rosenberger about 6 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2009-06-14
Priority:Should have Due date:
Assigned To:Bastian Waidelich % Done:

0%

Category:-
Target version:-
Has patch: Affected Flow version:

Description

The following code from documentation does not work:

<f:form.select name="paymentOptions" options="{payPal: 'PayPal International Services', visa: 'VISA Card'}" selectedValue="visa" />

Error:

PHP Fatal error:  Uncaught exception 'Tx_Fluid_Core_Parser_Exception' with message 'Argument "selectedValue" 
was not registered.' in typo3\sysext\fluid\Classes\Core\Parser\TemplateParser.php:402

fluid_3657.patch Magnifier - adds selected value argument and sets selected if nothing selected (1.3 kB) Christian Müller, 2009-06-14 01:36

History

#1 Updated by Christian Müller about 6 years ago

Well, could you try this patch?

I do not think it will be final, as I am not sure about the value of $selectedValue in case of nothing selected (first render of form). Hope the check works with === false...

#2 Updated by Marcel Rosenberger about 6 years ago

After applying the patch no error is thrown anymore. However the "visa" option is not selected.

#3 Updated by Christian Müller about 6 years ago

Marcel R. wrote:

After applying the patch no error is thrown anymore. However the "visa" option is not selected.

A change from

if(($selectedValue === false) && $this->arguments->hasArgument('selectedValue') && ($this->arguments['selectedValue'] === (string)$value)){

to

if(empty($selectedValue) && $this->arguments->hasArgument('selectedValue') && ($this->arguments['selectedValue'] === (string)$value)){

should make it working, but has other non wished effect (will always select options with emtpy or zero value), so the return value of $selectedValue has to be changed I think.

#4 Updated by Bastian Waidelich about 6 years ago

Marcel R. wrote:

The following code from documentation does not work:

the documentation is wrong here. All Form view helpers have an argument "value". Could you please try whether this works:

<f:form.select name="paymentOptions" options="{payPal: 'PayPal International Services', visa: 'VISA Card'}" value="visa" />

btw: have a look at https://svn.typo3.org/TYPO3v4/CoreProjects/MVC/viewhelpertest/ to see all the extisting view helpers in action

#5 Updated by Bastian Waidelich about 6 years ago

  • Status changed from New to Needs Feedback

#6 Updated by Marcel Rosenberger about 6 years ago

With attribute value it's working. I tested:

<f:form.select name="paymentOptions" options="{payPal: 'PayPal International Services', visa: 'VISA Card', master: 'MasterCard'}" value="visa" />

as well as
<f:form.select name="paymentOptions" options="{payPal: 'PayPal International Services', visa: 'VISA Card', master: 'MasterCard'}" value="{0: 'master', 1: 'visa'}" multiple="multiple" />

I would like to see the documentation changed inside SelectViewHelper.php accordingly.

#7 Updated by Bastian Waidelich about 6 years ago

  • Status changed from Needs Feedback to Accepted
  • Assigned To set to Bastian Waidelich

#8 Updated by Bastian Waidelich about 6 years ago

  • Status changed from Accepted to Resolved

Inline documentation has been fixed in r2914

#9 Updated by Bastian Waidelich almost 6 years ago

  • Project changed from Extbase MVC Framework to TYPO3.Fluid
  • Category deleted (432)

Also available in: Atom PDF