for a delete button next to the image in the views, i think you can achieve 
it using A built in helpers.
e.g. not tested
in views for delete button
{{=SPAN(A(I(_class='icon-remove'), callback=URL('function_callback', 
args=image.id)), 
delete='tr', _title='Remove Image' % p.name, _class='btn btn-danger'))}}

in view for ajax form
<form id="myform">
<input type="file" name="image" id="image"><br>
<input type="submit" />
</form>

<script>
jQuery('#myform').submit(function() {
  ajax('{{=URL('function_callback')}}',
       ['image'], ':eval');
  return false;
});
</script>

and in controllers :
def function_callback():
record = db.person(request.args(0)) or redirect(URL('index'))
    form = SQLFORM(db.image, record)
    if form.accepts(request, formname = None):
        return DIV("Image uploaded")
    elif form.errors:
        return TABLE(*[TR(k, v) for k, v in form.errors.items()])

ref :
http://web2py.com/books/default/chapter/29/05/the-views#Built-in-helpers

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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