[web2py] How to create a new record in database without submit buttons

2011-07-02 Thread dorasan
Hello everyone. Could you tell me how to create a new record in database without submit buttons? I actually would like to do it by the onclick event. I know that I can call the ajax function like this. input name=name onClick=ajax('writing', ['title'], 'target') / But I dont know what I have

Re: [web2py] How to create a new record in database without submit buttons

2011-07-02 Thread cjrh
In the method called by the AJAX event, you don't need the form at all. You can just do a straight insert. You must pass the data to be inserted as part of the AJAX call, either via args, or post data or some other method on the URL. Then, inside writing(), just do a direct DB insert as

Re: [web2py] How to create a new record in database without submit buttons

2011-07-02 Thread portable dora
'Insert' method. That is what I wanted to know. Thank you so much!! 2011/7/2 cjrh caleb.hatti...@gmail.com In the method called by the AJAX event, you don't need the form at all. You can just do a straight insert. You must pass the data to be inserted as part of the AJAX call, either via

Re: [web2py] How to create a new record in database without submit buttons

2011-07-02 Thread Anthony
Note, in that case, you won't be taking advantage of any of the built-in form processing, such as input validation and return/display of form errors. To get the validation, you could use the .validate_and_insert() method, but you'd still have to manually process and deal with the potential

Re: [web2py] How to create a new record in database without submit buttons

2011-07-02 Thread portable dora
You were right Anthony. And I found what I exactly needed was 'Components' . I didn't want to refresh the entire page. But anyways, the fact that there is the insert method and it doesn't give me much to create a record from input forms, was new knowledge for me, so it was good to know about it.