You are missing a parenthesis in the code above, could that be the
issue, or was that only in your posting. Confirm you code looks like
public function executeSomething(){
if($this->getRequest()->isMethod('post')){
//do stuff
}
notice the 2 parenthesis in that code. As long as the form truly is
posting, that should work. As Eno suggested, confirm that the form
has method="post" in your html source.
In regard to the $this->getRequest() vs $request
if your action's function signature is:
"public function executeSomething(sfWebRequest $request)" you can use
the $request var, as it is passed to the function by Symfony
if your action's function signature is:
"public function executeSomething()" you will need to use $this-
>getRequest() to access the request object
HTH,
Casey
On May 5, 1:23 pm, Parijat Kalia <[email protected]> wrote:
> One sec, can you give me the reasoning for that please?
> I have several pages with forms that post....across all I have this
>
> function executeSomething()
> {
> if($this->getRequest()->isMethod('post')
> {
> // post button action
> }
>
> }
>
> all of these seem to be working, but when I load this particular page, it
> straight away enters the *if loop* and performs the action
> within......typically it shud enter this loop when the submit button is hit
> (lies within the form, the form specifies the post method action)
> 2010/5/5 Земсков Юрий <[email protected]>
>
>
>
>
>
> > method declaration looks like
>
> > public function executeSomething(sfWebRequest $request)
>
> > OR
>
> > public function executeSomething()
>
> > ? Try the first one.
>
> > Вы писали 5 мая 2010 г., 23:04:21:
>
> > Oh I tried that...it doesn't recognize the variable at all...what i did was
>
> > $request->isMethod('post')...so any clue?
>
> > On Tue, May 4, 2010 at 8:51 PM, fRAnKEnSTEin <[email protected]> wrote:
>
> > Hi there,
>
> > If you are inside some controller action you can try "$request-
>
> > >isMethod('post')" instead "$this->getRequest()->isMethod('post')"
>
> > Tell me what happen if you give it a try...
>
> > Cheers
>
> > --
>
> > 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 [email protected]
>
> > To unsubscribe from this group, send email to
>
> > [email protected]<symfony-users%2bunsubscr...@goog
> > legroups.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 [email protected]
>
> > To unsubscribe from this group, send email to
>
> > [email protected]<symfony-users%2bunsubscr...@goog
> > legroups.com>
>
> > For more options, visit this group at
>
> >http://groups.google.com/group/symfony-users?hl=en
>
> > --
>
> > С уважением,
>
> > Земсков Юрий
> > mailto:[email protected]<[email protected]>
>
> > --
> > 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<symfony-users%2bunsubscr...@goog
> > legroups.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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group
> athttp://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 [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