[TYPO3-mvc] f:form.select is not saved

Felix Eggbert eggbert at phez.com
Thu Mar 17 14:17:28 CET 2011


Hi Christian,

I have observed a similar behaviour: Everything is saved fine when using
<f:form.select property="category" multiple="true" options="{categories}"
optionLabelField="title" optionValueField="uid" />.

But as soon as I use <f:form.select property="category"
options="{categories}" optionLabelField="title" optionValueField="uid"/>
(thus rendering a single select box) the value selected is not saved
anymore.

In my extension everything else is set up correctly, too. I think otherwise
it also wouldn't be able to save using the multiselect selec box.

Best regards,
Felix

-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
Christian Kartnig
Gesendet: Donnerstag, 17. März 2011 08:21
An: typo3-project-typo3v4mvc at lists.typo3.org
Betreff: Re: [TYPO3-mvc] f:form.select is not saved

Hi!

Thanks for answering! This is really bugging me.
Here are the declaration, setter, TCA and SQL for the country relation. 
These are all generated by the kickstarter and I can't see why it should not
work out. Can you have a look, please?

best regards,
Christian


/**
  * country
  *
  * @var Tx_Top1001_Domain_Model_Country
  */
protected $country;


/**
  * Sets the country
  *
  * @param Tx_Top1001_Domain_Model_Country $country
  * @return void
  */
public function setCountry($country) {
	$this->country = $country;
}


'country' => array(
	'exclude'	=> 0,
	'label'		=> 
'LLL:EXT:top1001/Resources/Private/Language/locallang_db.xml:tx_top1001_doma
in_model_company.country',
	'config'	=> array(
		'type' => 'select',
		'foreign_table' => 'tx_top1001_domain_model_country',
		'minitems' => 0,
		'maxitems' => 1,
		'wizards' => array(
			'_PADDING' => 1,
			'_VERTICAL' => 0,
			'edit' => array(
				'type' => 'popup',
				'title' => 'Edit',
				'script' => 'wizard_edit.php',
				'icon' => 'edit2.gif',
				'popup_onlyOpenIfSelected' => 1,
				'JSopenParams' =>
'height=350,width=580,status=0,menubar=0,scrollbars=1',
				),
			'add' => Array(
				'type' => 'script',
				'title' => 'Create new',
				'icon' => 'add.gif',
				'params' => array(
	
'table'=>'tx_top1001_domain_model_country',
					'pid' => '###CURRENT_PID###',
					'setValue' => 'prepend'
					),
				'script' => 'wizard_add.php',
			),
		),
	),
),


CREATE TABLE tx_top1001_domain_model_company (
	[...]
	country int(11) unsigned DEFAULT '0',
)



Am 14.03.2011 10:38, schrieb Franz Koch:
> Hey,
>
>> Thanks for answering, Franz!
>> Yes, an 1:1 relationship works well. Still the problem described is
>> there. The reference to the country is not saved, unless I set the uid
>> like this:
>>
>> $countryUid = $company->getCountry()->getUid();
>> $company->setCountry($countryUid);
>
> This should actually give you a exception or php error unless your
> setCountry method expects an integer and not a country object. How does
> your setCountry method look like (including comments) and how is the
> country property declared (also including comments)?
>

_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list