ajax was because in my case I only block/unblock access by updating
registry_id in auth_user... So I wouldn't leave the page and no further
page update were required...

If you click on an A link of course you will be redirected, except if you
set ajax stuff with onclick...

You can also not redirecting and update some component with onclick and
web2py.component(...) (web2py ajax call for web2py component system)

Richard

On Thu, Apr 9, 2015 at 2:56 PM, Ron Chatterjee <[email protected]>
wrote:

>
>
> On Thursday, April 9, 2015 at 2:47:12 PM UTC-4, Ron Chatterjee wrote:
>>
>> Derek,
>>
>> I didn't understand what you meant by " 'a' link to /btnon it will also
>> call your function"? Do you mean, if I click on that button it executes a
>> python function for example and redirect the page or display the function
>> output to someone in index.html (where the button is displayed)? What will
>> be the syntax for that? I usually follow this from the tutorial:
>>
>
> <form action="form_name">
> <input type="submit" />
> </form>
>
> And then in the controller I can simply do:
>
> if form.process().accepted:
>  redirect(URL('to_the_page'))
>
> And for the link, I believe the type will change. I guess someone can also
> do ajax('butnon',[],null);" and change butnon to 'link'. And then process
> once clicked.
>
>
>
>
>>
>> On Thursday, April 9, 2015 at 12:45:08 PM UTC-4, Derek wrote:
>>>
>>> Richard's answer should work, but I just wanted to add, if you put an
>>> 'a' link to /btnon it will also call your function.
>>>
>>> On Thursday, April 9, 2015 at 6:32:21 AM UTC-7, DXX wrote:
>>>>
>>>> So im just starting with Python / Web2py .... i want to do a simple
>>>> test page to have a button to turn on a led on a RPi...
>>>>
>>>> the default.py looks like this
>>>>
>>>> import RPi.GPIO as GPIO
>>>>
>>>> def index():
>>>>     return dict(message="this is a test")
>>>>
>>>> def btnon():
>>>>     GPIO.setmode(GPIO.BCM)
>>>>     GPIO.setup(22, GPIO.OUT)
>>>>     GPIO.output(22,GPIO.HIGH)
>>>>
>>>>
>>>> What i would like to do is call that btnon on an event, like a click on
>>>> something to make it exectute the commands.... if this something i can do
>>>> on a simple way, if you can guide me, i will be greatly appreciated
>>>>
>>>>  --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to