Yes, thank you, this did it for me
if request.args[0] in ('view','edit','new'):
    grid.element('[title='+T('Back')+']')['_href'] = URL('')


I didn't need to use "parent" because in my case grid.showbuttontext == 
False

On Friday, July 12, 2013 6:53:13 PM UTC+2, Anthony wrote:
>
> Maybe something like:
>
> if request.args[-3] in ['view', 'edit']:
>     grid.element('[title=Back]').parent['_href'] = URL(...)
>
> Anthony
>
> On Friday, July 12, 2013 10:32:57 AM UTC-4, step wrote:
>>
>> How can I change from python the href value of SQLFORM.grid's back icon 
>> button which is automatically added to the create/update/view form?
>> SQLFORM.grid sets the value to the referer's URL, but I ran into a 
>> situation where that setting is grossly illogical, so I need to work around 
>> the default setting.
>>
>> For reference, the illogical setting comes about this way:
>> 1. In start.html {{=LOAD(...start.load...ajax=True)}}
>> 2. In start.load {{=grid_1}} which returns SQLFORM.grid(...)
>> 3. grid_1 includes links to other.html?keywords=... (a search form), 
>> click a link to go to other.html
>> 4. In other.html {{=grid_2}}, that is another SQLFORM.grid without ajax 
>> loading
>> 5. Now, in the same browser tab, browse start.html
>> 6. Click a row edit link in start.html which displays grid_1's update form
>> So far so good, but...
>> 7. Click the back icon button in the update form; web2py puts you back 
>> into other.html instead of start.html
>> So I want to work around web2py when it sets the href value of the back 
>> icon button and set it to start.load as it should be
>>
>> TIA
>>
>

-- 

--- 
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/groups/opt_out.


Reply via email to