Form submit error when using CKEditor plugin for web2py -
i using ckeditor plugin web2py. problem have on form, when clicks dropdown value, form submitted using javascript, id in request.vars used generate new form values(form.vars.body), works fine until code reaches form.accepts(req..., sess..). reason widget value(form.vars.body) changed original value before submit(other form.vars fields change , work fine). question form.accepts(req.., ses..) change or call in widget code again revert particular field original value.
query1 = db.contents.event_instance_id==event_instance_id
query2 = db.contents.section==section_id
contents = db(query1 & query2).select(db.contents.id, db.contents.title,db.contents.body).first()
record=contents.id fields = ['id','section', 'title', 'body'] # form # returns correct form.xml right content db.contents.body form = sqlform(db.contents, record, fields=fields, submit_button=t('save content')) if form.accepts(request.vars, session): response.flash = t("contents saved") elif form.errors: response.flash = t("error saving content") # after form.accepts form.xml different, form.vars.body different, # passed view wrong content field widget return dict(form=form, title=title, event_instance_id=event_instance_id)
in model
db.define_table('contents', field('event_instance_id', 'reference event_instance', label='event instance'), field('section', 'reference sections'), field('title', length=255, requires=is_not_empty()), field('body', 'text', requires=is_not_empty(), widget=ckeditor.widget) )
in view {{=form}}
Comments
Post a Comment