Yes, coz it cannot be called like this. The problem is not in web2py but 
in your page. You have to use proper javascript call. So the result 
should look like:

<button onclick="window.location = {{=URL(r=request, 
f='add_records')}}">Crea attività</button>

Then i think this will work as you expected.

Michal alias Plysak :)

Marco Prosperi wrote:
> Sorry but with
> <button onclick={{=URL(r=request, f='add_records')}}>Crea attività</
> button>
> the function 'add_records' is never called
> 
> while with
> <a href="{{=URL(r=request,f='add_records')}}">crea attività</a>
> then 'add_records' is called and works (I can see it because it
> creates a file)
> 
> maybe is this the wrong syntax?
> 
> Marco
> 
> 
> On 24 Mar, 10:12, Yarko Tymciurak <[email protected]> wrote:
>> On Tue, Mar 24, 2009 at 3:17 AM, Marco Prosperi
>> <[email protected]>wrote:
>>
>>
>>
>>> hi all,
>>> I would like to put a button in one of my pages so that when the users
>>> clicks it, a computation on the database get started. I don't know the
>>> syntax I have to use. Probably something like:
>>> <button onclick=!!what_am_I_supposed_to_put_here?!!>click me</button>
>> <button onclick={{=URL(r=request, f='some_function')}} >...
>>
>> but there may be a better way depending on what you are trying to do...
>>
>>
>>
>>> any hint? Or maybe there is a better approach?
>>> Marco
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to