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

Reply via email to