Redirect to update action of dynamic scaffolding

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Redirect to update action of dynamic scaffolding

elvanor
Hi,

I am trying to add a FileUpload capability to a normal scaffolding view. So I defined a new action "upload" and call that from the view. The upload part goes smoothly but after that I'd like to redirect to the update action so that the object can be updated normally.

When doing

redirect(action:update, params: params)

I get a 403 (Forbidden) in the browser.

So is it possible to redirect to the update action at all? I noticed a strange thing, when I overrided the update action in a controller (this was in another controller, just for a test):

    def update =
    {       
        println (params)
        println ("eaererr")
    };

and I tried to go there via the scaffolded views, it never went into this code (since nothing was printed out). However I tried:

    def _action_Update
    {
        println "qe"
        println (params)       
    }

and then it went there.

I am confused, can someone help?

Jean-Noël

Reply | Threaded
Open this post in threaded view
|

Re: Redirect to update action of dynamic scaffolding

hamishagain@dcs.shef.ac.uk
somethign to do with the allowedMethods field of the controller perhaps?

h


Jean-Noël Rivasseau wrote:

> Hi,
>
> I am trying to add a FileUpload capability to a normal scaffolding view.
> So I defined a new action "upload" and call that from the view. The
> upload part goes smoothly but after that I'd like to redirect to the
> update action so that the object can be updated normally.
>
> When doing
>
> redirect(action:update, params: params)
>
> I get a 403 (Forbidden) in the browser.
>
> So is it possible to redirect to the update action at all? I noticed a
> strange thing, when I overrided the update action in a controller (this
> was in another controller, just for a test):
>
>     def update =
>     {      
>         println (params)
>         println ("eaererr")
>     };
>
> and I tried to go there via the scaffolded views, it never went into
> this code (since nothing was printed out). However I tried:
>
>     def _action_Update
>     {
>         println "qe"
>         println (params)      
>     }
>
> and then it went there.
>
> I am confused, can someone help?
>
> Jean-Noël
>

--
Hamish
http://www.dcs.shef.ac.uk/~hamish/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Redirect to update action of dynamic scaffolding

graemer
In reply to this post by elvanor
This is due to default HTTP method restrictions. The update action by
default expects an HTTP post (ie a form submission)

Cheers

On 5/23/07, Jean-Noël Rivasseau <[hidden email]> wrote:

> Hi,
>
> I am trying to add a FileUpload capability to a normal scaffolding view. So
> I defined a new action "upload" and call that from the view. The upload part
> goes smoothly but after that I'd like to redirect to the update action so
> that the object can be updated normally.
>
> When doing
>
> redirect(action:update, params: params)
>
> I get a 403 (Forbidden) in the browser.
>
> So is it possible to redirect to the update action at all? I noticed a
> strange thing, when I overrided the update action in a controller (this was
> in another controller, just for a test):
>
>     def update =
>     {
>         println (params)
>         println ("eaererr")
>     };
>
> and I tried to go there via the scaffolded views, it never went into this
> code (since nothing was printed out). However I tried:
>
>     def _action_Update
>     {
>         println "qe"
>         println (params)
>     }
>
> and then it went there.
>
> I am confused, can someone help?
>
> Jean-Noël
>
>


--
Graeme Rocher
Grails Project Lead
http://grails.org

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Redirect to update action of dynamic scaffolding

elvanor
In that case, how do I redirect using a POST ?

On 5/23/07, Graeme Rocher <[hidden email]> wrote:
This is due to default HTTP method restrictions. The update action by
default expects an HTTP post (ie a form submission)

Cheers

On 5/23/07, Jean-Noël Rivasseau <[hidden email]> wrote:

> Hi,
>
> I am trying to add a FileUpload capability to a normal scaffolding view. So
> I defined a new action "upload" and call that from the view. The upload part
> goes smoothly but after that I'd like to redirect to the update action so
> that the object can be updated normally.
>
> When doing
>
> redirect(action:update, params: params)
>
> I get a 403 (Forbidden) in the browser.
>
> So is it possible to redirect to the update action at all? I noticed a
> strange thing, when I overrided the update action in a controller (this was
> in another controller, just for a test):
>
>     def update =
>     {
>         println (params)
>         println ("eaererr")
>     };
>
> and I tried to go there via the scaffolded views, it never went into this
> code (since nothing was printed out). However I tried:
>
>     def _action_Update
>     {
>         println "qe"
>         println (params)
>     }
>
> and then it went there.
>
> I am confused, can someone help?
>
> Jean-Noël
>
>


--
Graeme Rocher
Grails Project Lead
http://grails.org

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Redirect to update action of dynamic scaffolding

elvanor
And how come my override on the update action does not work ??

On 5/23/07, Jean-Noël Rivasseau <[hidden email] > wrote:
In that case, how do I redirect using a POST ?


On 5/23/07, Graeme Rocher <[hidden email]> wrote:
This is due to default HTTP method restrictions. The update action by
default expects an HTTP post (ie a form submission)

Cheers

On 5/23/07, Jean-Noël Rivasseau <[hidden email]> wrote:
> Hi,
>
> I am trying to add a FileUpload capability to a normal scaffolding view. So

> I defined a new action "upload" and call that from the view. The upload part
> goes smoothly but after that I'd like to redirect to the update action so
> that the object can be updated normally.
>
> When doing
>
> redirect(action:update, params: params)
>
> I get a 403 (Forbidden) in the browser.
>
> So is it possible to redirect to the update action at all? I noticed a
> strange thing, when I overrided the update action in a controller (this was
> in another controller, just for a test):
>
>     def update =
>     {
>         println (params)
>         println ("eaererr")
>     };
>
> and I tried to go there via the scaffolded views, it never went into this
> code (since nothing was printed out). However I tried:
>
>     def _action_Update
>     {
>         println "qe"
>         println (params)
>     }
>
> and then it went there.
>
> I am confused, can someone help?
>
> Jean-Noël
>
>


--
Graeme Rocher
Grails Project Lead
<a href="http://grails.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://grails.org

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    <a href="http://xircles.codehaus.org/manage_email" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Redirect to update action of dynamic scaffolding

elvanor
In reply to this post by elvanor
I realized the def _action_Update bit was normal as I forgot the "=" so it was executed everytime. Still I don't understand why I cannot override the update action.

On 5/23/07, Jean-Noël Rivasseau <[hidden email]> wrote:
Hi,

I am trying to add a FileUpload capability to a normal scaffolding view. So I defined a new action "upload" and call that from the view. The upload part goes smoothly but after that I'd like to redirect to the update action so that the object can be updated normally.

When doing

redirect(action:update, params: params)

I get a 403 (Forbidden) in the browser.

So is it possible to redirect to the update action at all? I noticed a strange thing, when I overrided the update action in a controller (this was in another controller, just for a test):

    def update =
    {       
        println (params)
        println ("eaererr")
    };

and I tried to go there via the scaffolded views, it never went into this code (since nothing was printed out). However I tried:

    def _action_Update
    {
        println "qe"
        println (params)       
    }

and then it went there.

I am confused, can someone help?

Jean-Noël