On Jan 14, 2011, at 7:41 AM, annet wrote:
> 
> I have a form containing two buttons, one to update data and one to
> close the window:
> 
> {{=INPUT(_type='button',_value='Update
> data',_onclick=URL(r=request,f='update_form',args=[company[0].id]))}}
> {{=INPUT(_type='button',_value='Close window',_onclick='closeWin()')}}
> 
> The second button works, the first button doesn't. When I replace the
> code for the first button with:
> 
> <button
> onclick="document.location='{{=URL(r=request,f='update_form',args=[company[0].id])}}';">update
> gegevens</button>
> 
> The first button works as well, however, I don't understand why? I
> hope one of you can provide me with an explanation.

The value of the onclick attribute is interpreted as JavaScript. If you say 
onclick=URL(), you're setting it to a string, and that isn't going to do 
anything interesting.

Also, read the material in the web2py book about form self-submission. It's 
good advice.

Reply via email to