Yes you can call the LOAD your button like this:

{{=A(TAG.i(_class="icon-pencil"), _rel="tooltip", _title="give a comment",
_class="btn", _href='#' onclick="jQuery('#myLoad').show();")}


So put this DIV where you want to display your LOAD component

<div id="myLoad">
       {{=LOAD('default','comment.load',args=result.id,ajax=
True,ajax_trap=True,target="userComment")}}
</div>

make sure you hide the DIV on page load as follow...put this at the end of
your page

<script>
     jQuery('#myLoad').hide();
</script>

For hiding the component, I gues you can have a javascript event inside
your comment.load component that hides the <DIV>




On Tue, Dec 11, 2012 at 3:57 PM, jonas <[email protected]> wrote:

> Hi
>
> I have a link that redirects to a comment page:
>
> {{=A(TAG.i(_class="icon-pencil"), _rel="tooltip", _title="give a comment",
> _class="btn", _href=URL('comment',args=result.id))}
>
> But I want to use LOAD instead of filling a form in a separate page:
>
> {{=LOAD('default','comment.load',args=result.id
> ,ajax=True,ajax_trap=True,target="userComment")}}
>
> the controller and the view:
>
> def comment():
>
>     """ create comment form. Every comment is id locked to the specific
> post """
>
>     crud.settings.create_next = URL('index')
>     post=db(db.blog.id==request.args(0)).select().first()
>     db.comments.post_id.default=post.id
>     form=crud.create(db.comments)
>
>     return dict(form=form)
>
> {{=form.custom.begin}}
> <div class="row">
>       <h5>date: </h5>{{=form.custom.widget.created_on}}
> </div>
> <div class="row">
>       <h5>name: </h5>{{=form.custom.widget.created_by}}
> </div>
> <div class="row">
>       <h5>mail: </h5>{{=form.custom.widget.mail}}
> </div>
> <div class="row">
>       <h5>link: </h5>{{=form.custom.widget.link}}
> </div>
> <div class="row">
>       <h5>comment:</h5>{{=form.custom.widget.comment}}
> </div>
> {{=form.custom.submit}}
> {{=form.custom.end}}
>
> How do I trigger the load function from the button, i.e can I replace the
> URL tag with a call to LOAD?
> Is it possible to close the LOAD form after completed form so it disappear
> again or at least clear the field and gives a response.flash = T("Posted!")?
>
> --
>
>
>
>



-- 
.......................................................................................
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 



Reply via email to