+1

On Thursday, 13 September 2012 12:17:17 UTC-5, Henrik Holm wrote:
>
> Has this "add_button" been added to one of the recent releases?  I'm 
> running 1.99.7 and I get 
>
>   *<type 'exceptions.AttributeError'> 'SQLFORM' object has no attribute 
> 'add_button'*
>
> Maybe it's time to upgrade :-)
>
> Thanks,
> Henrik
>
>
> On Tuesday, July 17, 2012 1:43:08 PM UTC-4, Massimo Di Pierro wrote:
>>
>> In trunk:
>>
>> form.add_button("Cancel",URL(r=request,f='new_contact'))
>>
>> On Tuesday, 17 July 2012 10:00:59 UTC-5, Mathias wrote:
>>>
>>> I found a good solution for me : 
>>>
>>> form[0][-1][1].append(TAG.INPUT(_value='Cancel',_type="button",_onclick="window.location='%s';"%URL(r=request,f='new_contact')))
>>>  
>>>
>>>
>>> Mathias 
>>>
>>>
>>> 2012/7/17 Mathias Van Daele <[email protected]>: 
>>> > Thanks for your solution Richard ! 
>>> > 
>>> > I am still looking for a solution with a button component... 
>>> > 
>>> > Mathias 
>>> > 
>>> > 2012/7/17 Richard Vézina <[email protected]>: 
>>> >> Maybe this could be enough?? 
>>> >> 
>>> >> {{=A(T('cancel'),_href="javascript:void(history.go(-1))")}} 
>>> >> 
>>> >> It will bring you back to the precedent page, in my use case, I 
>>> direct the 
>>> >> user on a crud.read page where the user can edit the record 
>>> (crud.update). 
>>> >> Then if don't want make change anymore there is a "cancel" hyperlink 
>>> that 
>>> >> bring back the user on the crud.read page. 
>>> >> 
>>> >> Richard 
>>> >> 
>>> >> 
>>> >> On Tue, Jul 17, 2012 at 8:13 AM, Mathias <[email protected]> 
>>> wrote: 
>>> >>> 
>>> >>> Hello, 
>>> >>> 
>>> >>> I have added a CANCEL button to my SQLFORM. 
>>> >>> 
>>> >>> Form submission prevents the correct working of it. 
>>> >>> 
>>> >>> I have tried to avoid form submission with this code : 
>>> >>> 
>>> >>> 
>>> >>> def new_guest_contact(): 
>>> >>>    form = SQLFORM.factory(...) 
>>> >>> 
>>> >>> 
>>> >>> 
>>> form[0][-1][1].append(TAG.BUTTON('Cancel',_onclick='ajax("%s",[],":eval");return
>>>  
>>>
>>> >>> false' %URL(r=request,f='new_contact'))) 
>>> >>> 
>>> >>>    if form.process().accepted: 
>>> >>>         ... 
>>> >>>         redirect(URL(r=request,f='new_contact_part')) 
>>> >>>    elif form.errors: 
>>> >>>        response.flash = 'form has errors' 
>>> >>>    else: 
>>> >>>        response.flash = 'Create new guest' 
>>> >>> 
>>> >>>    return dict(form=form) 
>>> >>> 
>>> >>> 
>>> >>> If I click the cancel button now, nothing happens anymore. 
>>> >>> 
>>> >>> 
>>> >>> Any help is welcome. 
>>> >>> 
>>> >>> Thanks 
>>> >>> 
>>> >>> 
>>> >>> Mathias 
>>> >>> 
>>> >>> -- 
>>> >>> 
>>> >>> 
>>> >>> 
>>> >> 
>>> >> 
>>> >> -- 
>>> >> 
>>> >> 
>>> >> 
>>>
>>

-- 



Reply via email to