I cant seem to submit my form with this code:
@auth.requires_login()
def index():
db.post.answers.writable=False
db.post.answers.readable=False
form = SQLFORM(Post, formstyle='divs')
if form.process().accepted:
pass
code.....
return(form=form)
view:
{{=form.custom.begin}}
<div class="chat-form">
<textarea></textarea>
<button>Send</button>
</div>
{{=form.custom.end}}
My db is empty with no data submitted.Please help Regards
You must specify "name" attributes for your HTML input elements, and if you are using
SQLFORM
with a web2pyDAL
model, the input names must match the names of the model fields. So, in the example you have shown, you would need:Without the "name" attribute, the browser will not send the data. And if the name does not match any fields in the
DAL
model, web2py will not do anything with the submitted data.