Hmm ... sorry about that. Thank you very much for your idea. But my idea is to use the framework as much as possible, including the form validation. This would be decreasing my work load. Let's get into details a little bit.
I have some table defined in web2py model, including some requirements for each field. I think form.accepts() need more request variables than my form field. Correct me please. def prepare_form1(): import gluon.contrib.simplejson as sj form=SQLFORM(db.mytable, .....) form.accepts(request.vars,session) #prepare additional variables to set to form1 return sj.dumps(myvariables) def accept_form1(); import gluon.contrib.simplejson as sj form=SQLFORM(db.mytable, .....) if form.accepts(request.vars,session): # prepare good response else: # prepare corrective response # need to get the error messages return sj.dumps(myresponse) Or we have another better approach ? Best regards, mige mdipierro wrote: > This is a bit too general. > > You can make an action like > > def mycallback(): > # do something with request.vars > # compute r, a response > return response.json(r) > > In order to tell you how to propery use validators depends on how you > want the action retrun error messages. > > Massimo > > On Jan 27, 9:41 pm, mige harimurti <mige...@yahoo.co.id> wrote: > >> Hi all, >> >> I'm newbie in web2py. >> I have several HTML pages, some with multiple form inside one page. >> But the basic design are : >> 1. There is no server side HTML generated. >> On client side, only HTML + JS/AJAX . >> 2. Client only passing GET/POST via form-submit or AJAX or URL to server >> 3. Server only passing JSON to client. >> >> The objective is strict separation between Client & Server. >> >> What is the good way to use web2py to accept and validate my form. >> >> Thank you very much. >> >> Best regards, >> mige >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---