I'm not sure I understand. But from what I read it sounds like you don't need to bind.
If you're just rendering a view, there should be nothing to bind at that point. You only want to bind once data is submitted by the client. On Thu, May 5, 2011 at 7:56 AM, maboiteaspam <maboiteas...@wanadoo.fr>wrote: > Hi, > > How to post render a view with more than one form to show ? > > I 'm running in trouble to do so because sf2 frameworks does perfom form > validation upon all binded forms. > Where doing a post render of my view bring me to bind all forms. > And so on to validate form's i don't want to, because user simply did > not... > > My problem seem to be mainly situated in > Symfony\Component\Form\Form > > Where bind is always called by bindrequest, and where bindrequest does > always call for validators, except when the form is read only. > > I may have mis used the framework, reading to this. or not. > I don't know much. > > But the process could be a little bit different by involving a new state > defining if the user is currently, or not, submiting this Form Object. > And so, to validate we must have submitted=true, and inbound=true and > valid=true. > Also bind process could be chained to the submission on not to the bind. > But all of this, is much a change, and i want to think i m doing a mistake > because solution must be some where in my code or current usage of the > fw.... > > > I m also thinking in the use of read only property, because as i said > before, it does skip validators calls. > Right now, it is a solution, because both forms are instanciated, in the > same controller. > > But how to do this when there are used within modules and dynamic calls ? > > > > Thanks by advance. > Any help is appreciated. > > Symfony\Component\Form\Form > ... > /** > * Binds POST data to the field, transforms and validates it. > * > * @param string|array $clientData The POST data > */ > public function bind($clientData) > { > if ($this->readOnly) { > return; > } > > if (is_scalar($clientData) || null === $clientData) { > $clientData = (string)$clientData; > } > > // Initialize errors in the very beginning so that we don't lose > any > // errors added during listeners > $this->errors = array(); > > $event = new DataEvent($this, $clientData); > $this->dispatcher->dispatch(Events::preBind, $event); > > $appData = null; > $normData = null; > $extraData = array(); > $synchronized = false; > > // Hook to change content of the data bound by the browser > $event = new FilterDataEvent($this, $clientData); > $this->dispatcher->dispatch(Events::onBindClientData, $event); > $clientData = $event->getData(); > > if (count($this->children) > 0) { > if (null === $clientData || '' === $clientData) { > $clientData = array(); > } > > if (!is_array($clientData)) { > throw new UnexpectedTypeException($clientData, 'array'); > } > > foreach ($this->children as $name => $child) { > if (!isset($clientData[$name])) { > $clientData[$name] = null; > } > } > > foreach ($clientData as $name => $value) { > if ($this->has($name)) { > $this->children[$name]->bind($value); > } else { > $extraData[$name] = $value; > } > } > > // If we have a data mapper, use old client data and merge > // data from the children into it later > if ($this->dataMapper) { > $clientData = $this->getClientData(); > } > } > > if (null === $clientData || '' === $clientData) { > $clientData = $this->emptyData; > > if ($clientData instanceof \Closure) { > $clientData = $clientData->__invoke($this); > } > } > > // Merge form data from children into existing client data > if (count($this->children) > 0 && $this->dataMapper) { > $this->dataMapper->mapFormsToData($this->children, > $clientData); > } > > try { > // Normalize data to unified representation > $normData = $this->clientToNorm($clientData); > $synchronized = true; > } catch (TransformationFailedException $e) { > } > > if ($synchronized) { > // Hook to change content of the data in the normalized > // representation > $event = new FilterDataEvent($this, $normData); > $this->dispatcher->dispatch(Events::onBindNormData, $event); > $normData = $event->getData(); > > // Synchronize representations - must not change the content! > $appData = $this->normToApp($normData); > $clientData = $this->normToClient($normData); > } > > $this->bound = true; > $this->data = $appData; > $this->normData = $normData; > $this->clientData = $clientData; > $this->extraData = $extraData; > $this->synchronized = $synchronized; > > $event = new DataEvent($this, $clientData); > $this->dispatcher->dispatch(Events::postBind, $event); > > *foreach ($this->validators as $validator) { > $validator->validate($this); > }* > } > > /** > * Binds a request to the form > * > * If the request was a POST request, the data is bound to the form, > * transformed and written into the form data (an object or an array). > * You can set the form data by passing it in the second parameter > * of this method or by passing it in the "data" option of the form's > * constructor. > * > * @param Request $request The request to bind to the form > */ > public function bindRequest(Request $request) > { > // Store the bound data in case of a post request > switch ($request->getMethod()) { > case 'POST': > case 'PUT': > $data = array_replace_recursive( > $request->request->get($this->getName(), array()), > $request->files->get($this->getName(), array()) > ); > break; > case 'GET': > $data = $request->query->get($this->getName(), array()); > break; > default: > throw new FormException(sprintf('The request method "%s" is > not supported', $request->getMethod())); > } > > *$this->bind($data);* > } > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en