[FLOW3-general] Access fluid form object

Thomas Plessis t.plessis at totemnumerique.com
Wed Jan 11 11:34:56 CET 2012


For validator, yes you're right, i can move them to model. And yes, i've another action to display the form :

	/**
	 * Show a form for creating a new item object
	 *
	 * @return void
	 */
	public function newAction() {
		// Orders all regions by label ASC and assign them to the view
		$this->regionRepository->setDefaultOrderings(array('label' => \TYPO3\FLOW3\Persistence\QueryInterface::ORDER_ASCENDING));
		$this->view->assign('regions', $this->regionRepository->findAll());
		$this->view->assign('itemCategories', $this->categoryRepository->findCategoriesAsSelect());
	}

Thomas Plessis
Développeur multimédia
--
TOTEMnumerique
9, Place St Étienne
31000 Toulouse
T. 05 61 14 64 54
F. 05 61 14 64 55

Le 11 janv. 2012 à 11:17, Christian Müller (Kitsunet) a écrit :

> First, why don't you validate that in the model?
> 
> And second, that is the create action, but there should be a second action to display the form or do you do that in one action, if yes, I recommend to do it in separate actions.
> 
> Cheers,
> Christian
> 
> On 11/01/12 10:53, Thomas Plessis wrote:
>> Action like that, with many validations :
>> 
>> 	/**
>> 	 * Adds the given new item object to the item repository
>> 	 *
>> 	 * @param \Totem\Lewin\Domain\Model\Item $newItem A new item to add
>> 	 * @return void
>> 	 *
>> 	 * @FLOW3\Validate(value="newItem.price", type="\Totem\Lewin\Validation\Validator\PriceValidator")
>> 	 * @FLOW3\Validate(value="newItem.pictures[0].originalResource", type="\Totem\Lewin\Validation\Validator\PictureValidator")
>> 	 * @FLOW3\Validate(value="newItem.zipCode", type="\Totem\Lewin\Validation\Validator\ZipcodeValidator")
>> 	 */
>> 	public function createAction(Item $newItem) {
>> 
>> 
>> Thomas Plessis
>> Développeur multimédia
>> --
>> TOTEMnumerique
>> 9, Place St Étienne
>> 31000 Toulouse
>> T. 05 61 14 64 54
>> F. 05 61 14 64 55
>> 
>> Le 11 janv. 2012 à 10:33, Thomas Plessis a écrit :
>> 
>>> Hi guys,
>>> 
>>> I've a form for creating a new object (NOT updating). After submitting form, in case of a wrong validation, i want to display value of a textfield in a part of the page. But how to access values of the submitting form object?
>>> My form looks like:
>>> 
>>> <f:form action="create" name="formItem" object="{newItem}" enctype="multipart/form-data" id="grands_formulaires">
>>>  <label for="title">Titre</label><br />
>>>  <f:form.textfield property="title" id="title" size="40" required="required" /><br />
>>>  Title = {newItem.title}
>>>  <f:form.submit value="Publier" class="bt_envoyer" />
>>> </f:form>
>>> 
>>> but {newItem.title} display nothing… :/
>>> 
>>> regards,
>>> 
>>> Thomas Plessis
>>> Développeur multimédia
>>> --
>>> TOTEMnumerique
>>> 9, Place St Étienne
>>> 31000 Toulouse
>>> T. 05 61 14 64 54
>>> F. 05 61 14 64 55
>>> 
>>> _______________________________________________
>>> FLOW3-general mailing list
>>> FLOW3-general at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>> 
> 
> 
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general



More information about the FLOW3-general mailing list