LOAD itself cannot go in the href/onclick of a button because it is a
server-side function that generates JS you can try use it (with
ajax=True), look at the generated JS and put that into the BUTTON
onclick.

You can do

<BUTTON onclick="web2py_ajax_page('POST','{{=URL
(r=request,f='callback')}}',"a=b&c=d",'target')">click me</button>
<div id="target"></div>

and when you click the button is calls /yourapp/default/callback,
places the result in the target div and every form loaded in the div
will stay in the div even if submitted.

The ""a=b&c=d" argument can be any a urlencoded set of parameters.


On Jan 4, 12:15 am, "K.R.Arun" <the1.a...@gmail.com> wrote:
> hi,
> Is that mean I can use LOAD function in the register button's href
> attribute.
> You can see from my code that, my form needs some customization,
> that's why I used separate view.
> Now how can I load the form via ajax.
> can I load separate view within another view?
> what's the target for the AJAX loaded content?
>
> On Jan 3, 11:28 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > {{=LOAD(a,b,args=args,vars=vars,ajax=ajax,ajax_trap=ajax_trap)}}
>
> > a,b,args,vars are used to build the URL
> > URL(request.application,c=a,f=b,args=args,vars=vars)
>
> > if ajax=False the URL is called BEFORE the page is served
> > if ajax=True the URL LOAD just generate JS code to request tha page
> > via AJAX
> > if ajax_trap=True all forms in the content are captured and submitted
> > via AJAX.
> > ajax=True implied ajax_trap=True.
> > ajax=False implies args andvars are ignored and request.args ad
> > request.vars are used.
>
> > On Jan 3, 12:01 pm, "K.R.Arun" <the1.a...@gmail.com> wrote:
>
> > > On Jan 3, 1:25 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > well, you can do it with FROM (not SQLFORM.factory) but You would not
> > > > gain anything in your case.
>
> > > > About AJAX.
>
> > > > You could make something like
>
> > > > def ajax_user(): return auth() # instead of dict(form=auth())
>
> > > > and then in a page
>
> > > > {{=LOAD('default','ajax_user/register',ajax_trap=True)}}
>
> > > > you do not need to use LOAD, you can use ajax('...').
>
> > > Sorry, I can't able to understand it.
> > > I read it somewhere that LOAD can be used to AJAX load components into
> > > the page.
> > > BTW, in {{=LOAD('default','ajax_user/register',ajax_trap=True)}} ,
> > > what this parameters mean except 'default'?
> > > ajax_user is our function defined above, then what's register(Is it
> > > argumet??)?
> > > what is meant by return auth() (Is auth() is a function that returns a
> > > form object?)
>
> > > I'm from C++ and Java background, new to Python, hope wordings are apt
> > > to python also.
>
> > > Arun
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to