Answer below

On Mon, Apr 4, 2011 at 7:14 PM, Anthony <[email protected]> wrote:

> You're saying when the page loads, the LOAD component shows "loading...",
> but the create form never actually loads there? Can you reproduce the
> problem with a somewhat more simplified example?
>
>

Yes and I will try to reproduce the problem in a dedicated app...


> Also, is that view the 'create.html' view (so, you're loading a 'create'
> component on the 'create' page itself)?
>

Yes, I was in a pretty early stage of testing the component... I get
recursion when it "works"... I mean when I use {{=LOAD(c='ref',
f='create.load', ajax=True)}}... It recursively load the entire page since I
can't make it load my table form only... I try to load my component on an
other view instead.

Richard

>
> Anthony
>
> On Monday, April 4, 2011 4:11:16 PM UTC-4, Richard wrote:
>
>> Hello Anthony,
>>
>>  I have no problem using generic.load view for now...
>>
>> My problem is mostly related to the fact I use table name as args in my
>> url and without args 0 my function can't do anything...
>>
>> That why I tried with extension='.load'
>>
>> Here some code :
>>
>>
>> ## CONTROLLER :
>>  @auth.requires_login()
>> def create():
>>     if request.args(0) in ref_tables_list:
>>         redirection_argument=request.args(0)
>>         if en_ui_tables_names[request.args(0)]!=None :
>>             table_name = str.lower(en_ui_tables_names[request.args(0)])
>>         else:
>>             table_name = request.args(0).replace('ref_','')
>>         page_title=T('Form for : ')
>>         if auth.has_membership(auth.id_group('admin')):
>>             crud.settings.formstyle='divs'
>>             form = crud.create(db[request.args(0)])
>>         elif auth.has_membership(auth.id_group('user1')):
>>             crud.settings.formstyle='divs'
>>             form = crud.create(db[request.args(0)])
>>         elif auth.has_membership(auth.id_group('user2')):
>>             crud.settings.formstyle='divs'
>>             form = crud.create(db[request.args(0)])
>>         else:
>>             return
>> dict(form=None,page_title=page_title,table_name=table_name,\
>>                         not_allow_permission='you are not allow
>> (permission)',permission_denied='Permission denied')
>>         if form.accepts(request.vars, session):
>>             response.flash = T('form accepted')
>>             redirect(URL(r=request, f='read/'+redirection_argument,args=
>> form.vars.id))
>>         elif form.errors:
>>             response.flash = T('form has errors')
>>         else:
>>             response.flash = T('please fill out the form')
>>         return
>> dict(form=form,page_title=page_title,table_name=table_name,\
>>                     not_allow_permission=None,permission_denied=None)
>>     else:
>>         redirect(URL(request.application,'default','index'))
>>         session.flash = T('invalid request')
>>
>>
>> ## VIEW :
>>  {{extend 'layout.html'}}
>>
>>  <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')}}";
>> <!--<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">-->
>> @import
>> "{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/demos/demos.css')}}";
>> <!--<link rel="stylesheet" href="../demos.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 src="../../jquery-1.4.4.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 src="../../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 src="../../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 src="../../ui/jquery.ui.tabs.js"></script>-->
>> <script>
>> $(function() {
>>     $( "#tabs" ).tabs();
>> });
>> </script>
>>
>>
>> <div class="demo">
>>
>> <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">
>> {{if form!=None:}}
>>     <h2>{{=page_title}} {{=T(table_name)}}</h2>
>>     <br/>
>>     {{=form}}
>> {{else:}}
>>     {{=permission_denied}}
>>     <br/>
>>     {{=not_allow_permission}}
>> {{pass}}
>> {{pass}}
>>     </div>
>>     <div id="tabs-2">
>>         test2
>>     </div>
>>     <div id="tabs-3">
>>         test3
>>     </div>
>>     <div id="tabs-4">
>>
>>  
>> {{=LOAD(c='ref',f='create',args='ref_eregistry',extension='.load',ajax=True)}}
>>     </div>
>> </div>
>>
>> </div><!-- End demo -->
>>
>>
>> Thanks for your help.
>>
>> Richard
>>
>> On Mon, Apr 4, 2011 at 3:08 PM, Anthony <[email protected]> wrote:
>>
>>> I'm not sure if this is your only problem, but isn't it supposed to be
>>> extension='load' rather than extension='.load'? Also, have you actually
>>> created a 'myfunction.load' view file (inside the /views/mycontroller/
>>> folder)? If not, web2py should attempt to use the 'generic.load' view.
>>>
>>> Anthony
>>>
>>> On Monday, April 4, 2011 2:46:53 PM UTC-4, Richard wrote:
>>>
>>>> Hello,
>>>>
>>>>  It seems that I have to modified completly my app to make it work with
>>>> components, I would just like to confirm it...
>>>>
>>>> Here a my url : myapp/mycontroller/myfunction/mytable or args 0
>>>>
>>>> When I try
>>>>
>>>>
>>>> {{=LOAD(c='mycontroller',f='myfunction',args='mytable',extension='.load',ajax=True)}}
>>>>
>>>> It keeps loading... for ever.
>>>>
>>>> It seems that if ".load" is not applied to myfunction.load it can't
>>>> work... If I try : myfunction.load and args=mytable noting better happen.
>>>>
>>>> Thanks
>>>>
>>>> Richard
>>>>
>>>
>>

Reply via email to