Hello Anthony,

I can't use a var like you suggest since it popup in the component for
noting...

I am using session.MYVAR that seems to work... But I don't find the way to
get session vars in jQuery I try like this :

<script>
$(function() {
    var $tabs = $( "#tabs" ).tabs();
    var test1 = "{{=session.test1}}"; # OR like this :
<%{{=session.test1}}%> and with and without quote or double quote...
    $tabs.tabs('select',  test1);
        return false;
});
</script>

If I can get my variable value in jQuery do you think it a go work around?

Richard

On Thu, Jun 23, 2011 at 11:09 AM, Anthony <[email protected]> wrote:

> I don't think you want to call response.write in your controller -- it
> appends text to the response body, so you would be adding the text before
> the rest of the response body is rendered by the view. You also shouldn't
> need to call response.write from within the view, because you can just do
> {{=whatever_you_want_to_write}}.
>
> Instead, you should be able to just pass a variable to the view. In your
> controller, return dict(form=form, tab=tab), and in your view, {{=tab}}.
>
> Anthony
>
> On Thursday, June 23, 2011 10:36:39 AM UTC-4, Richard wrote:
>
>> Hello,
>>
>> In order to get the proper tabs to render the validators message in case
>> they have been triggered I would like to know if I use response.write(TABS
>> INDEX) could be a option??
>>
>> Here my set up :
>>
>> *VIEW*
>>  <style type="text/css" title="currentStyle">
>> @import "{{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/**
>> development-bundle/themes/**base/jquery.ui.all.css')}}";
>> </style>
>>
>> <script type="text/javascript" charset="utf-8"
>> src="{{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/**
>> js/jquery-1.4.4.min.js')}}"></**script>
>> <script type="text/javascript" charset="utf-8"
>> src="{{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/**
>> development-bundle/ui/jquery.**ui.core.js')}}"></script>
>> <script type="text/javascript" charset="utf-8"
>> src="{{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/**
>> development-bundle/ui/jquery.**ui.widget.js')}}"></script>
>> <script type="text/javascript" charset="utf-8"
>> src="{{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/**
>> development-bundle/ui/jquery.**ui.tabs.js')}}"></script>
>> <script>
>> $(function() {
>>     var $tabs = $( "#tabs" ).tabs();
>>     $tabs.tabs('select', {{response.write()}});
>>         return false;
>> });
>> </script>
>>
>>
>> <div class="demo">
>> <br/>
>> <br/>
>> <br/>
>> <div id="tabs">
>>     <ul>
>>         <li><a href="#tabs-1">{{=T('folder').**capitalize()}}</a></li>
>>         <li><a href="#tabs-2">{{=T('volume').**capitalize()}}</a></li>
>>         <li><a href="#tabs-3">{{=T('tome').**capitalize()}}</a></li>
>>         <li><a href="#tabs-4">{{=T('report').**capitalize()}}</a></li>
>>     </ul>
>>     <div id="tabs-1">
>>     <br/>
>>         {{=LOAD(c='ref',f='create_**fvte',args='ref_fnaregistry',**
>> extension='load',ajax=False,**ajax_trap=False,target='one')}**}
>>     </div><!-- tabs-1 -->
>>     <div id="tabs-2">
>>     <br/>
>>         {{=LOAD(c='ref',f='create_**fvte',args='ref_vregistry',**
>> extension='load',ajax=False,**ajax_trap=False,target='two')}**}
>>     </div><!-- tabs-2 -->
>>     <div id="tabs-3">
>>     <br/>
>>         {{=LOAD(c='ref',f='create_**fvte',args='ref_tregistry',**
>> extension='load',ajax=False,**ajax_trap=False,target='three'**)}}
>>     </div><!-- tabs-3 -->
>>     <div id="tabs-4">
>>     <br/>
>>         {{=LOAD(c='ref',f='create_**fvte',args='ref_eregistry',**
>> extension='load',ajax=False,**ajax_trap=False,target='four')**}}
>>     </div><!-- tabs-4 -->
>> </div><!-- tabs -->
>>
>> </div><!-- End demo -->
>>
>> *CONTROLLER*
>>  def creation():
>>     """
>>     Empty function for make it works the jQuery tabs plugin for ref_*
>> tables.
>>     """
>>     a = None
>>     return dict(a=a)
>>
>> @auth.requires_login()
>> def create_fvte():
>>     table = request.args(0)#.replace('.**load','')
>>     if auth.has_membership(auth.id_**group('admin')):
>>         crud.settings.formstyle='divs'
>>         form = crud.create(db[table])
>>         for i in range(0,len(form[0])):
>>             if len(form[0][i][2][0]) > 0:
>>                 form[0][i][0].append(SPAN((**helpicon(),
>> SPAN(form[0][i][2][0])),_**class='tooltip'))
>>             del(form[0][i][2])
>>     elif auth.has_membership(auth.id_**group('technician')):
>>         crud.settings.formstyle='divs'
>>         form = crud.create(db[table])
>>         for i in range(0,len(form[0])):
>>             if len(form[0][i][2][0]) > 0:
>>                 form[0][i][0].append(SPAN((**helpicon(),
>> SPAN(form[0][i][2][0])),_**class='tooltip'))
>>             del(form[0][i][2])
>>     elif auth.has_membership(auth.id_**group('technician_c')):
>>         crud.settings.formstyle='divs'
>>         form = crud.create(db[table])
>>         for i in range(0,len(form[0])):
>>             if len(form[0][i][2][0]) > 0:
>>                 form[0][i][0].append(SPAN((**helpicon(),
>> SPAN(form[0][i][2][0])),_**class='tooltip'))
>>             del(form[0][i][2])
>>     else:
>>         return dict(form=None)
>>     if form.accepts(request.vars, session):
>>         session.flash = T('form accepted')
>>         if table == 'ref_fnaregistry':
>>             redirect(URL(c='ref', f='creation#tabs-2'))
>>         elif table == 'ref_vregistry':
>>             redirect(URL(c='ref', f='creation#tabs-3'))
>>         elif table == 'ref_tregistry':
>>             redirect(URL(c='ref', f='creation#tabs-4'))
>>         #elif table == 'ref_eregistry':
>>         #    redirect(URL(c='ref', f='creation#tabs-2'))
>>     elif form.errors:
>>         response.flash = T('form has errors')
>>         #if table == 'ref_fnaregistry':
>>         #    redirect(URL(c='ref', f='creation#tabs-1'))
>>         #elif table == 'ref_vregistry':
>>         #    redirect(URL(c='ref', f='creation#tabs-2'))
>>         if table == 'ref_tregistry':
>>             response.write(2)
>>         #    redirect(URL(c='ref', f='creation#tabs-3'))
>>         #elif table == 'ref_eregistry':
>>         #    redirect(URL(c='ref', f='creation#tabs-4'))
>>     else:
>>         response.flash = T('please fill out the form')
>>     return dict(form=form)
>>
>>
>> I try to avoid ajax=True,ajax_trap=**False option of LOAD() cause they
>> seem to conflict with the official jQuery UI Tabs plugin (loading pretty
>> slow, reload after submit with triggered validator even worse and try to
>> load the entire site before loading only my proper form).
>>
>> I may not completly understand usage of component...
>>
>> Thanks to help.
>>
>> Richard
>>
>

Reply via email to