You have to move the form logic in its own action

def myform():
       form = SQLFORM(....).process()
       if form.accepted: form = 'Done!'
       return form

Then do

<button class="btn btn-primary" data-toggle="collapse" 
data-target="#create-group"> 
        Create new group <span class="caret"></span> 
</button> 
<div id="create-group" class="collapse"> 
        <div class="alert alert-block alert-info fade in"> 
                <button class="alert close" data-toggle="collapse" 
data-target="#create-group"> 
                        &times; 
                </button> 
                {{=LOAD('default','myform', ajax=True)}} 
        </div> 
</div> 


On Saturday, 21 July 2012 04:41:07 UTC-5, Alec Taylor wrote:
>
> That sounds good, but I'm having trouble coding it up: 
>
> <button class="btn btn-primary" data-toggle="collapse" 
> data-target="#create-group"> 
>         Create new group <span class="caret"></span> 
> </button> 
> <div id="create-group" class="collapse"> 
>         <div class="alert alert-block alert-info fade in"> 
>                 <button class="alert close" data-toggle="collapse" 
> data-target="#create-group"> 
>                         &times; 
>                 </button> 
>                 {{=LOAD(create, ajax=True)}} 
>         </div> 
> </div> 
>
> `create` is the form... how am I meant to do this? 
>
> Thanks for all suggestions, 
>
> Alec Taylor 
>
> On Sat, Jul 21, 2012 at 7:28 PM, Massimo Di Pierro 
> <[email protected]> wrote: 
> > Have you considered using LOAD(...,ajax=True) to load the form into the 
> > `#sesame` div? It will make your life much easier. 
> > 
> > 
> > On Saturday, 21 July 2012 02:02:21 UTC-5, Alec Taylor wrote: 
> >> 
> >> I've made a nice form effect using Twitter Bootstrap, where you click 
> >> the "Add new group" button, and it bring up a form. 
> >> 
> >> Example: http://jsfiddle.net/sRUbd/ 
> >> 
> >> Unfortunately when there is a form error, the form area collapses, so 
> >> I never see the error (unless I click "Add new group" again). 
> >> 
> >> Can I run arbitrary HTML on validation error? — Basically I want to 
> >> run `#sesame`... the name of the div containing the form. 
> >> 
> >> Thanks for all suggestions, 
> >> 
> >> Alec Taylor 
> > 
> > -- 
> > 
> > 
> > 
>

-- 



Reply via email to