On Jun 19, 5:42 am, ilovesss2004 <yyiillu...@gmail.com> wrote:
> Hi,
> How can I let python controller get the value of a textfield when I
> press a button in html page (not a submit button)?

This is a question of client-server transaction:  it does not matter
(really) what the client is, or what the server is:
The question you ask is a very basic one:  the client _somehow_ sends
some value;  the server _somehow_ sees it.

There is actually model-view-controller at each -- client and server
-- and a communication channel.

SO your question boils down to this:  how do you collect what you want
on the client (the "M" - model, the data there is the element which
contains the test you want;  the "V" is how it is displayed, and the
"C" - controller is how you respond at that end to user input:
click?  hover?  touch?).

Once you have sorted through how you choose to do that - let's say you
do an HTML PUT call --- then you will send parameters to your selected
controller, which in this case will see some parameters in
request.args.    Which args you send from client (perhaps you will use
javascript;  perhaps a jQuery library) and how you send them (submit?
PUT?  ajax, or not)   --- this is one part of your task.   The second
- at the controller - is seeing the args, ensuring they are the
correct vars, and doing something (e.g. storing them) at the server /
web2py end.

Your question - not a submit button - is about how to do this at the
client end.    The controller pulling out request.vars (or perhaps
even pulling from an uploaded file) --- that should be the relatively
easy part.

You might start by looking searching www.web2pyslices.com.    Try
looking at, and understanding the clienttools slice
http://www.web2pyslices.com/main/slices/take_slice/8

Hope this is helpful.

Regards,
Yarko
>
> Thanks a lot.

Reply via email to