> > Is it possible to validate CRUD form fields using ajax without > submitting the form in web2py? > > I have gone through the web2py online doc and have seen this link: > http://web2py.com/books/default/chapter/29/11#Ajax-form-submission So we > may do it using custom html. But I want to do it using CRUD. Also in crud > form,a field of type date shows calendar only after the validation fails > and user begins to enter the correct date. Can it be showed on the first > attempt itself?? >
Yes, you can use custom HTML for Crud forms, but by default, Crud will insert hidden _formname and _formkey fields in the form (the latter is used to protect against CSRF attacks). Because Crud will expect those fields to be submitted with the form, the form has to be created via Crud, and the form object has to be passed to the view so you can include those fields. See here <http://web2py.com/books/default/chapter/29/7#Custom-forms> for details on creating custom HTML for forms. Note, to make it easier to submit the form via Ajax, you might consider putting the form in an Ajax component via LOAD() (see here<http://web2py.com/books/default/chapter/29/12#Components> ). Anthony