Hi all,
I wonder is am doing something wrong. creating a user (normal user), i 
tried inserting into a database from a custom form, But the values aren't 
inserting, and not errors is generated.
But when i leave the field empty, i get an error message.
please could anyone help!

controller:
def ajax_create():
  return dict()

@auth.requires_login()
def create_company():
  form = SQLFORM(db.compan)
  if form.accepts(request,formname=None):    
    record = db(db[request.vars.tname]['id'] == form.vars.id).select()
    return "show(%s);" % (repr(record)) 
  elif form.errors:
    return "show(%s)" % repr('error')

view:
ajax_create.html

{{extend 'layout.html'}}
<form>
    Name of company:<input type='text' id='create_company' name='name' />
    <input type='button' id='fsubmit' value='Submit' />
</form>
<script>
    function show(text){
    alert(text)
    }
    $('#fsubmit').click(function(){
        ajax('create_company', ['name'], ':eval')    
    })

</script>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to