My custom form work fine, After one day I work to make my HTML5 valid on end it only action in form make error. And after that I reed all what I can find but not helped me.
And on my previews post I put my actual and next form definition in controller (people or index is not to much important where is redirected) I need only to get something in action field in form. If is this possible in form.custom.begin - - Miroslav Gojic - - On Sun, Oct 16, 2011 at 18:50, Miroslav Gojic <miroslavgo...@gmail.com> wrote: > My errors in previews post: > > form['_action'] = URL(index') - my error - correct is> -> > form['_action'] = URL('index') > my_value - is mean -> URL('controller') #this can be controller or > index or some value. > > From last Anthony replay I figure out why it can't work from view but > how to resolve this in controller. > > this is my form definition in controller: > def people(): > form = crud.create(db.person,next=URL('people'),message=T("record > created")) > return dict(form = form) > > I try next example and all mentioned options: > def people(): > form = crud.create(db.person,next=URL('people'),message=T("record > created")) > form['_action'] = URL('index') > return dict(form = form) > > but my action field in form is empty. > > - - Miroslav Gojic - - > > > On Sun, Oct 16, 2011 at 16:09, Anthony <abasta...@gmail.com> wrote: >> On Sunday, October 16, 2011 3:23:01 AM UTC-4, miroslavgojic wrote: >>> >>> I tray to put mentioned examples into controller after my form definition >>> >>> form['_action'] = URL(index') >>> form.update(_action=URL('index')) >>> form.attributes.update(_action=URL('index')) >>> >>> but it is not happened anything, >> >> What exactly happened? I assume this does change the form action as >> expected, but then nothing happens when you submit the form? When you change >> the form action, the form will get submitted to that action. If you submit >> the form to 'index', then your 'index' function will have to process the >> submitted form -- if there's no code in your 'index' function to do so, then >> nothing will happen. In web2py, forms are typically self-submitting (i.e., >> submitted to the action that generated them). Is there a reason you want to >> submit the form to a different action? >> >>> >>> and if I change my value I just get error >>> >>> form.update(_action=my_value) - this make error >> >> What is my_value? Is it a URL? >> >>> >>> In view after beginning of form.custom.start I tray next similar code >>> {{=form['_action'] = URL(index')}} >> >> I assume you mean form.custom.begin? Anyway, it will not work to change the >> form action after that because form.custom.begin actually inserts the <form> >> tag with the action specified -- so changing the action after will not >> affect the way the form is serialized. >> Anthony >> >