Hi Richard,

Thanks for the reply!  I decided to go with an easier solution due to time 
constraints but I'm still very interested in how my issue would've been 
solved.  You mention to pass the _onclick variable as a kwarg but the A() 
helper would not accept it.  Also, I do not understand how I would be able 
to send it to my 'extend' controller function or how the A() _onlick prompt 
would trigger.  Can you please clarify your solution?

Regards,
Jimmy

On Thursday, July 17, 2014 7:23:13 AM UTC-7, Richard wrote:
>
> Yes, but I guess you need to pass it like that :
>
> **{'*_onclick*': *"var reason=prompt('Reason for extending?'); return 
> reason;"*}
>
> Richard
>
>
> On Wed, Jul 16, 2014 at 8:09 PM, <[email protected] <javascript:>> wrote:
>
>> Hi all,
>>
>> I started using web2py a week ago with little MVC experience.  I have a 
>> page displaying a database table using a SQLFORM.grid() where each row has 
>> buttons to extend a time variable or delete the row.  I want to add a 
>> pop-up prompt which asks the user why they are extending the time variable.
>>
>> My links in the controller displaying the database:
>>     ## instantiate row variable with database output
>>
>>     links = [{'header': '', 'body': lambda row: A('extend',
>>                                                   _class='btn',
>> *                                                  _onclick="var 
>> reason=prompt('Reason for extending?'); return reason;",*
>>                                                   _href=URL('extend', 
>> args=[row.project_name, row.kill_date]))},
>>              {'header': '', 'body': lambda row: A('kill',
>>                                                   _class='btn',
>>                                                   callback=URL('kill', 
>> args=[row.project_name]),
>>                                                   delete="tr")}]
>>
>>     grid = SQLFORM.grid(...., links=links, ...)
>>     return dict(form=grid)
>>
>> My view:
>> {{extend 'layout.html'}}
>> {{=form}}
>>
>> When I press the extend button, the prompt comes up and I can enter a 
>> string.  Where does that string go to and how do I access it so that I can 
>> use it in the 'extend' controller?  Is there a different way I should be 
>> doing this?
>>
>> Thanks,
>> Jimmy
>>
>> -- 
>> 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] <javascript:>.
>> 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