I am not sure I fully understand the question since this is not a
web2py specific questions.

If a page has a button:

<button onclick="{{=URL(r=request,f='sayhi')}}">click me</button>

when you click it will call the action sayhi(), For example

def sayhi(): return dict(message="hello")

Normally you use <input> inside a <form>...</form>. The form is
submitted to the action specified in <form action="....">.
web2py uses postbacks, i.e. It alwys submits the form to the same
action that generated the form.

Not sure I answered your question.

Massimo

On Apr 3, 6:38 pm, "r...@devshell.org" <roman.goldm...@gmail.com>
wrote:
> I am trying to just understand where web2py stores the request data,
> i.e. for various inputs and for buttons, how will I tell which button/
> input is being activated by the user.
>
> I am making a simple calculator, and I want some buttons to be
> type="button", not type "submit". However, once they are
> type="button", what does web2py use to determine what it should do.
>
> What I am looking for here is an example like:
>
> default/index.html
> <input type="button" name="sayhello"></input>
>
> default/result/index.html
> Hello World!
>
> How do I get the button on the default/index.html page, to call the
> default/result/index.html page, and call the helloworld() function in
> the controller for that page?
>
> On Apr 3, 1:58 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > normally what you do is:
>
> > if form.accepts(request.vars): redirect(URL(r=request,f='index'))
>
> > web2py uses postbacks. You do not have to but it makes your life much
> > easier. Or are you trying to submit a web2py form to a non-web2py
> > action?
>
> > Massimo
>
> > On Apr 3, 1:48 pm, "r...@devshell.org" <roman.goldm...@gmail.com>
> > wrote:
>
> > > Hi there,
>
> > > I was wondering about the button input type. I know it is recommended
> > > to use a input submit type, however, if one were wanting to use a
> > > button, how could I have web2py forward to another page with it?
>
> > > ie. <input type="button" name="register"></input> <--- I want that to
> > > redirect to register/index.html in the VIEW.
>
> > > Also, I found the epydoc request class to be missing the vars method
> > > description, only get_vars is listed (which happens to be the same).
> > > However, if I replace get_vars with just vars in the address bar, it
> > > forwards me to the vars method description...its weird that it is not
> > > listed as a method.
>
> > > Lastly, is there a tutorial or anything about how to use CSS (classes
> > > over ids) with the various HTML tags in web2py ie. FORMS, TABLE, TR,
> > > TD, INPUT, etc.
>
> > > Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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