db.table.validate_and_update(**kwargs)
On Fri, Sep 9, 2011 at 2:01 PM, GD <[email protected]> wrote:
> Hi,
> given this model:
>
> db.define_table('foo',
> Field('name'))
>
> a jquery function in the view:
>
> var new_data = {name: 'new foo name'};
> $.post(
> url,
> new_data,
> function(result){
> // some kind of action upon success
> },
> 'json'
> );
>
> let's say that url is already built in order to take the record id as
> an argument,
> so the controller has the following "behavior":
>
> def update():
> record = db.foo(request.args(0)) # this works
> form = SQLFORM(db.foo, record) # this works
> if form.accepts(request.vars, session): # this is never hit
> return dict(message='record updated')
> else:
> return dict(message='data did not validate') # this is always
> hit
>
> so the questions are
> why it doesn't validate?
> If it is not because any mistake on my side: is this an intended
> behavior?
> If it is intended: how is it possible to validate data passed
> "programmatically" by a jquery function without human direct input?
>
> Thanks
--
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]