I'm very sorry to annoy you all with this again. But I'm completely
stuck with forms in sf1.1 (meanwhile I upgraded to 1.1.3).
Even if I strictly follow chapter one of the "Symfony Forms Book", I
get the my parameters mixed up. But only, if I leave parameter values
empty.
A short example: I have the following fields in my form: Name, Email
and Message. If now only fill the Message (Name and Email are empty)
and then submit the form, my parameters look the following;
Name => email
Email =>
Message => some message
The name of the Email field automatically becomes the value of the
name field.
Has anyone made this experience? What do I do wrong????
To be clear: I strictly followed the example of chapter one in the
forms book.
I am running sf1.1.3 on an ubuntu system with apache 2.2.8 and php
5.2.4
I hope there is someone to give me a clue...
Thanks,
Martin
On 26 Sep., 09:58, Martin Groh <[EMAIL PROTECTED]> wrote:
> Yes, it's submitted with POST method.
> This ist the form class (not much magic there):
>
> class ContactForm extends sfForm {
> public function configure()
> {
> $this->setWidgets(array(
> 'name' => new sfWidgetFormInput(),
> 'firstname' => new sfWidgetFormInput(),
> 'email' => new sfWidgetFormInput(),
> ));
>
> $this->widgetSchema->setNameFormat('contact[%s]');
>
> $this->setValidators(array(
> 'name' => new sfValidatorString(array(), array('required'
> => 'Bitte geben Sie Ihren Namen an.')),
> 'firstname' => new sfValidatorString(array('required' =>
> false)),
> 'email' => new sfValidatorEmail(array(), array('required' =>
> 'Bitte geben Sie Ihre Emailadresse an.', 'invalid' => 'Bitte geben Sie
> eine gültige Mailadresse an.')),
> ));
> }
>
> }
>
> This is the according action:
>
> public function executeIndex($request)
> {
> $this->getUser()->setAttribute('startpage',false);
> $this->form = new ContactForm();
>
> if ($request->isMethod('post'))
> {
> $this->form->bind($request->getParameter('contact'));
> if ($this->form->isValid())
> {
>
> $this->redirect('contact/thankyou?'.http_build_query($this->form->getValues()));
>
> }
> }
>
> }
>
> I'm running sf1.1.2 on an Ubuntu8.04 system with an Apache 2.2.8 and
> PHP5.2.4
> If have the sfDocrine and the sfDoctrineTree plugins installed if that
> is of interest.
> Can I support you with anything else?
>
> The http_build_query in the action works fine, if I print it out in
> the action.
>
> Thanks for your support...
> Martin
>
> On 26 Sep., 09:17, Fabien Potencier <[EMAIL PROTECTED]
>
> project.com> wrote:
> > Hi Martin,
>
> > Can you give us some more information about your configuration. Is the
> > form submitted with a POST method?
>
> > Fabien
>
> > --
> > Fabien Potencier
> > Sensio CEO - symfony lead developer
> > sensiolabs.com | symfony-project.com | aide-de-camp.org
> > Tél: +33 1 40 99 80 80
>
> > Martin Groh wrote:
> > > Hello an greetings from sunny but cold river Rhine,
>
> > > I'm trying out the new forms system and really and really appreciate
> > > all the advantages it offers. Great work there! Thank you...
> > > But for some reason, my very simple contact form does not behave as
> > > expected.
> > > When I fill every field, all is well. The parameters look the
> > > following;
> > > sfParameterHolder Object
> > > (
> > > [parameters:protected] => Array
> > > (
> > > [name] => a
> > > [firstname] => b
> > > [email] => [EMAIL PROTECTED]
> > > [module] => contact
> > > [action] => thankyou
> > > )
> > > )
>
> > > but when I leave "firstname" empty, I get the following:
> > > sfParameterHolder Object
> > > (
> > > [parameters:protected] => Array
> > > (
> > > [name] => a
> > > [firstname] => email
> > > [EMAIL PROTECTED] => 1
> > > [module] => contact
> > > [action] => thankyou
> > > )
> > > )
>
> > > What I found out, is that the ServerVar PATH_INFO looks a bit strange
> > > to me. After sending the form, I have (amongst others) these to
> > > ServerVars set:
> > > [REQUEST_URI] => /frontend_dev.php/contact/thankyou/name/a/firstname//
> > > email/c%40c.de
> > > [PATH_INFO] => /contact/thankyou/name/a/firstname/[EMAIL PROTECTED]
>
> > > Why is the empty field between firstname and email missing in the
> > > PATH_INFO? Is this the intended behaviour? Has anyone else run up to
> > > this?
>
> > > Thanks a lot in advance!
> > > Martin
>
> > > PS: I posted this in the forum as well, unfortunately with no
> > > response, so I'll try it here again.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---