After using the Form framework for a while, it seems that the "Anonymous"
forms are gone, *but* you can use a named form and bind directly to the data
without it being structured with said name.

For example, instead of using $form->bindRequest($this->get('request')),
which would require the form data to be submitted as formname[formfield],
you should be able to do $form->bind($this->get('request')->request->all()),
which will allow your form data to be submitted as just formfield.

This is untested, so be sure to tweak as necessary.

On Thu, May 5, 2011 at 12:57 PM, Michael Holm <ho...@hollo.dk> wrote:

> Hi Donald,
>
> Thank you very much for the help with the name at least.. i have
> searched all that i could on google, and in the form source for
> anonymous form, but i dont see it anywhere..
>
> i think that i have tried everything that i can even think of..
>
> i have seen that also the userbundle make the form manually for the login
> form?
>
> so im still looking for a way for build "anonymous forms" with the new
> form framework, or just confirm that it is just not possible?
>
> it would be really useful for doing the validation in my rest api,
> also just to build the login form..
>
> Best regards,
> Michael Holm
>
>
>
> On Thu, May 5, 2011 at 4:27 PM, Donald Tyler <chekot...@gmail.com> wrote:
> > It's possible to have "anonymous forms", or at least it was before the
> Form
> > refactoring in Beta1. I never used them myself, but maybe that'll give
> you a
> > clue of where to look.
> >
> > On Thu, May 5, 2011 at 9:15 AM, Michael Holm <ho...@hollo.dk> wrote:
> >>
> >> Hi,
> >>
> >> Thanks a lot for the quick reply.. but, its just my api, it would be
> >> nice that i can expect the data:
> >>
> >> curl http://localhost/rest/add/user -d"email_address=ho...@hollo.dk"
> >>
> >> instead of:
> >>
> >> curl http://localhost/rest/add/user
> >> -d"register[email_address]=ho...@hollo.dk"
> >>
> >> i have the same problem when i want to render my login form, i have to
> >> do that manually because symfony except:
> >>
> >> <input name="_username" />
> >> <input name="_password />
> >>
> >> so, if there are any way to like remove that "html namespace" or what
> >> ever i can call it, i would be so glad to know.. if there are no way,
> >> its fine too.. i just cannot find any documents telling me the one
> >> thing or the other..
> >>
> >> Best regards,
> >> Michael Holm
> >>
> >>
> >>
> >> On Thu, May 5, 2011 at 4:08 PM, Donald Tyler <chekot...@gmail.com>
> wrote:
> >> > Why is this complicated?
> >> > As long as the FormType has a getName() method that returns
> "register",
> >> > the
> >> > Form will properly bind to the data when you call bindRequest().
> >> >
> >> > On Thu, May 5, 2011 at 9:03 AM, Michael Holm <ho...@hollo.dk> wrote:
> >> >>
> >> >> Hi,
> >> >>
> >> >> Im building a REST API for my application, and what i want to do is
> >> >> use the form component to validate the input from the users..
> >> >>
> >> >> But the problem is:
> >> >>
> >> >> If i have a form class, really basic example:
> >> >>
> >> >> public function buildForm(FormBuilder $builder, array $options))
> >> >> {
> >> >>  $buider->add('email_address');
> >> >> }
> >> >>
> >> >> public function getDefaultOptions(array $options)
> >> >> {
> >> >>  return array(
> >> >>    'data_class' => 'Pub\UserBundle\Entity\User'
> >> >>  );
> >> >> }
> >> >>
> >> >> all this is almost just fine, then problem come when i get my data..
> >> >> the form expect the form to look like:
> >> >>
> >> >> <input type="text" name="register[email_address]" />
> >> >>
> >> >> that will just make the api a whole lot more complicated, are there
> >> >> any way to make the form expect a html tag like this:
> >> >>
> >> >> <input type="text" name="email_address" />
> >> >>
> >> >> Hope that someone can help me..
> >> >>
> >> >> Best regards,
> >> >> Michael Holm
> >> >>
> >> >> --
> >> >> 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
> >> >
> >>
> >> --
> >> 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
> >
>
> --
> 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

Reply via email to