Still nop!

I also try to put it in the if table == like this :

        if table == 'ref_fnaregistry':
            #redirect(URL(request.application,c='default',f='index.html'))
            form.update(_class='no_trap',
_action=URL('default','creation.html'),args=1)
            return dict(form=form)
            #URL(request.application,c='default', f='creation.html',args=1)

I don't think changing the action for 'create_fvte.html' is logic... I mean
my create_fvte is a component function and it serves to load all the 2
components ref_fnaregistry and ref_vregistry...

Maybe I should drop this function and create 2 functions one for each
component or form...

Anyway using your line of code directly give a empty page theres is no shell
for the component I mean no Tabs plugin and no code at all in the
create_fvte.hml view...

Richard

On Wed, Jun 29, 2011 at 11:38 PM, Anthony <[email protected]> wrote:

> OK, I forgot the underscore before 'action' (I also forgot to include
> request.args in the form action URL) -- I think this should do it:
>
> form.update(_class='no_trap',
> _action=URL('default','create_fvte.html',args=request.args))
>
>
> Note, adding the .html extension to create_fvte above ensures that when the
> form is submitted back to this function, the extension will be .html, which
> is the extension that will be passed to the redirects.
>
> Also, you should remove the following from create_fvte:
>
> else:
>     response.flash = T('please fill out the form')
>
>
> The problem with that is that when you redirect to the /creation URL, it
> reloads your components, and the response.flash from the components
> overrides the session.flash that was passed to the /creation page. Instead,
> put the following in the creation() function:
>
> if not request.args:
>     response.flash = T('please fill out the form')
>
>
> That will flash 'please fill out the form' when the /creation page is
> loaded without any arguments, but not otherwise.
>
> With those small changes, I believe it all works as you want now.
>
> Anthony
>
>
> On Wednesday, June 29, 2011 9:57:09 PM UTC-4, Richard wrote:
>
>> It clear validator if they trigger and don't know why the redirection
>> don't works neither...
>>
>> Maybe pbreit is right and I should just forget about redirection... It's
>> probably what I will do for now, cause I can't spend any longer on this
>> picky stuff for now. It's part of the 20% percent stuff...
>>
>> Thanks anyway, I really appreciate your help.
>>
>> ;-)
>>
>> Richard
>>
>>
>> On Wed, Jun 29, 2011 at 6:54 PM, Anthony <[email protected]> wrote:
>>
>>> Sorry, the **dict() isn't really needed -- you can just do:
>>>
>>> form.element('form').update(**_**class='no_trap',
>>> action=URL('default','create_**f**vte'))
>>>
>>>
>>> Actually, in the URL() call above, you might be better off doing
>>> 'create_fvte.html' to ensure it doesn't use the .load extension, which would
>>> then propagate to the redirect (unless you explicitly specify .hmtl in the
>>> redirect).
>>>
>>> Anthony
>>>
>>> On Wednesday, June 29, 2011 6:02:42 PM UTC-4, Anthony wrote:
>>>
>>>> Try this:
>>>>
>>>>     form = crud.create(db[table])
>>>>     form.element('form').update(******dict(_class='no_trap',
>>>> action=URL('default','create_**f**vte')))
>>>>
>>>>
>>>> The _class='no_trap' should turn off the trapping of the form, and the
>>>> action=URL('default','create_**f**vte') should ensure that the
>>>> untrapped form gets submitted back to the create_fvte function rather than
>>>> the parent page (i.e., the index function). Because the form will not be
>>>> submitted via ajax, the redirect should work as usual and reload the entire
>>>> page.
>>>>
>>>> Anthony
>>>>
>>>
>>

Reply via email to