I checked your form with this:
def insert_flexiblecost():
if inputform.accepts
(request.vars,session,formname='form_newflexiblecost'):
print 'done'
return dict(form=inputform)
and your form works great. he problem is somewhere else.
In particular I do not see in your code the place where the form is
returned and inserted in the view. Something is wrong with the
workflow.
Massimo
On Jun 21, 8:07 am, matkolbe <[email protected]> wrote:
> Hello there,
>
> I have a problem, validating the form does not react.
>
> The code in the controller inputform is defined global):
>
> inputform=FORM(TABLE(TR(B(T('Date:')),INPUT
> (_type="text",_name="new_date",_class="field-width-80 field-padding-
> right-10",_id="new_datepicker_id",requires=[IS_NOT_EMPTY(),IS_DATE
> (format=T('%Y/%m/%d'))]),_class="tr-height-30"),
> TR(B(T('Amount:')),INPUT
> (_type="text",_name="new_amount",_id="new_amount_id",requires=
> [IS_NOT_EMPTY(), IS_FLOAT_IN_RANGE(0,100000)],_class="field-
> width-150"),_class="tr-height-30"),
> TR(B(T('Description:')),INPUT
> (_type="text",_name="new_description",_id="new_description_id",requires=IS_NOT_EMPTY
> (), _class="field-width-150"),_class="tr-height-30"),
> TR(T('Comment:'),INPUT(_type="text",_name="new-
> comment",_id="new_comment_id",_class="commentfield field-width-150")),
> TR("",INPUT(_type="submit",_value=T("Add new
> entry")),_class="sendingbutton tr-
> height-50")),_formname="form_newflexiblecost",_id="form-
> newflexiblecost_id")
>
> and the ajax function:
> def insert_flexiblecost():
> savesuccess="-1"
> if inputform.accepts
> (request.vars,session,formname='form_newflexiblecost'):
> from applications.haushaltsbuch.modules.custom_timefunctions
> import convert_to_timestamp
> current_date=convert_to_timestamp
> (inputform.vars.new_date_id.year,inputform.vars.new_date_id.month,inputform.vars.new_date_id.day,
> 0,0,0)
> inserted_id=db.flexible_cost.insert
> (book_id=session.bookid,description=inputform.vars.new_description_id,amount=inputform.vars.new_amount_id,
> \
>
> comment=inputform.vars.new_comment_id,in_date=current_date,timetable_id=session.monthdateid)
> if inserted_id>0:
> savesuccess="1"
> else:
> savesuccess="0"
> elif inputform.errors:
> savesuccess="0"
> return savesuccess
>
> I always get -1 returned. It seems like the accepts() is not
> registering the form submit. I exactly realized like in the ebook
> mentioned...
>
> Has anyone a similar problem?
>
> grettings,
> mathew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---