This should work. I do not see why it does not work. Can you email me,
perhaps privately, an example app so I can reproduce it?
On Sunday, 16 December 2012 09:26:54 UTC-6, jonas wrote:
>
> here is the custom form:
>
> {{=form.custom.begin}}
> <div class="row">
> <h5>date: </h5>{{=form.custom.widget.created_on}}
> </div>
> <div class="row">
> <h5>name: </h5>{{=form.custom.widget.created_by}}
> </div>
> <div class="row">
> <h5>mail: </h5>{{=form.custom.widget.mail}}
> </div>
> <div class="row">
> <h5>link: </h5>{{=form.custom.widget.link}}
> </div>
> <div class="row">
> <h5>comment:</h5>{{=form.custom.widget.comment}}
> </div>
> {{=form.custom.submit}}
> {{=form.custom.end}}
>
>
> The second question is as follows: when the form is filled and
> submitted, it should be clean, i.e no text in it or something else
> that indicates that the submission was successful and possible
> collapsed to. It is true that the redirect(index) returns data from
> the data base but I want to avoid that in this case, so another form
> of redirect would be better.
>
> On Sun, Dec 16, 2012 at 3:35 PM, Massimo Di Pierro
> <[email protected] <javascript:>> wrote:
> > Hello Jonas,
> >
> > Can you show us your custom form, the one that does not work. Validation
> and
> > form processing are done before the view is execued therefore it cannot
> > affect form validation and processing. perhaps that is something in the
> > custom form that prevents error messages from being displayed.
> >
> > I do not understand the second question. The index function returns all
> > records for each table.
> >
> > Massimo
> >
> >
> > On Saturday, 15 December 2012 17:27:51 UTC-6, jonas wrote:
> >>
> >> Hi.
> >>
> >> I have a default form that is passed in view: {{=form}}
> >> using this validation and insertion works. but when I use a custom form
> >> none of that works. why?
> >> Also form.process().accepted works only when using default form.
> >>
> >> My second question is: when submitting the form I redirect to index,
> and
> >> all entries in the db are returned. Is that because i reuse the index
> >> function? Is there any way to clear all fields after a successful
> submit?
> >>
> >> the code:
> >>
> >> default.py:
> >>
> >> def index():
> >>
> >> query=db.blog.id>0
> >> res=db(query).select(orderby=~db.blog.date)
> >> query=db.about.id>0
> >> about=db(query).select()
> >> query=db.comments.post_id>0
> >> com=db(query).select(orderby=~db.comments.created_on)
> >>
> >> return dict(res=res,about=about,com=com,message=T('Everything
> should
> >> be made as simple as possible, but not simpler'))
> >>
> >> def comment():
> >>
> >> """ create comment form. Every comment is id locked to the specific
> >> post """
> >>
> >> post=db(db.blog.id==request.args(0)).select().first()
> >> db.comments.post_id.default=post.id
> >> form=crud.create(db.comments)
> >> if form.process().accepted:
> >> print 'form accepted'
> >> redirect(URL('index'))
> >> else:
> >> print 'not accepted'
> >> return dict(form=form)
> >>
> >> index.html:
> >>
> >> {{=A(TAG.i(_class="icon-plus-sign"), _rel="tooltip", _title="testing",
> >> _class="btn", _href='#', _onclick="jQuery('#uc').toggle();")}}
> >> <div id="uc">
> >> {{=LOAD('default','comment.load',args=result.id,ajax=True)}}
> >> </div>
> >>
> >> comment.load:
> >>
> >> {{=form}}
> >>
> >> thanks
> >
> > --
> >
> >
> >
>
--