LOAD only gives "Loading..." after upgrade

159 views
Skip to first unread message

Brian M

unread,
Dec 17, 2013, 12:44:23 AM12/17/13
to web...@googlegroups.com
This would seem to be the same issue as https://groups.google.com/d/topic/web2py/kyEYmfQs6L0/discussion  but yet the solution offered there (make sure you've got the latest web2py.js) doesn't seem to be working for me. Oddly, I've got another form being loaded with LOAD(ajax=True) on the same page and that one works just fine.

What I'm trying to do is have a datatable with "Edit" links next to each record. When the edit link is clicked on, a jQueryUI dialog is opened and the dialog is told to load the edit page for the chosen record which is done using javascript to build the appropriate URL for the chosen record and then a regular jquery .load() to fetch it into the dialog. The edit controller's view is then using web2py's LOAD() to insert the actual edit form with ajax=True so the edit form can be submitted without ever leaving the main page.  This was working perfectly in older web2py (v 2.4.x) but now when I try to finally upgrade to web2py v2.8.2 all I get within the dialog is "Loading..."  I've verified that my app has the latest static/js/web2py.js (and web2py_ajax.html, appadmin.py and appadmin.html) as outlined in the release/upgrade notes for v2.6.

Anybody have ideas about what might be going wrong (or a better way to go about this)?

Thanks
~Brian

Massimo Di Pierro

unread,
Dec 17, 2013, 1:53:48 AM12/17/13
to web...@googlegroups.com
Try check with the google chrome js console. It should tell you what is going on.

Brian Meredyk

unread,
Dec 17, 2013, 7:26:14 AM12/17/13
to web2py@googlegroups com

Thanks Massimo I will give that a try. Was using firebug last night but wasn't seeing any errors or anything.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/cQpjb-On7jY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Anthony

unread,
Dec 17, 2013, 9:09:12 AM12/17/13
to web...@googlegroups.com
We probably need to see some code.

Brian M

unread,
Dec 17, 2013, 11:31:03 AM12/17/13
to web...@googlegroups.com
Chrome's JS Console isn't showing anything either. All it has is a note about "event.returnValue is deprecated. Please use the standard event.preventDefault() instead. " but that's coming from jquery.js itself (v1.10.2) and not my code so I don't think that's the cause.

I'm also noticing that a jGrowl message I've got being returned when the user checks a checkbox (it does a call back to the server) is being displayed twice so something else must have changed in web2py.js or elsewhere to cause that.

I'll try to see if I can make a fresh demo app to show this.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.

Brian M

unread,
Dec 17, 2013, 12:26:19 PM12/17/13
to web...@googlegroups.com
OK, I've got a simple app that shows the behavior:

controllers/demo.py


# coding: utf8
# try something like
def index():
   
return dict(message="hello from demo.py")


def edit_loader():
    loader
= LOAD(f='edit_form', ajax=True)#change to ajax=False and form is shown in dialog
   
return dict(loader = loader)


def edit_form():
    form
= SQLFORM.factory(
           
Field('first_name', 'text'),
           
Field('last_name', 'text')
                           
)
   
return dict(form = form)

views/demo/index.html

{{extend 'layout.html'}}


{{if 'message' in globals():}}
<h3>{{=message}}</h3>


<h4>{{=T('How did you get here?')}}</h4>
<ol>
 
<li>{{=T('You are successfully running web2py')}</li>
</ol>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}


<a class="updateDialog" href="{{=URL(r=request, f='edit_loader')}}">open edit dialog</
a>


<div id="edit_dialog" title="Edit record"></div>
<script type="text/javascript">
$
(function() {
    $
("#edit_dialog").dialog({
        width
: 600,
        height
: 355,
        modal
: true,
        autoOpen
: false
   
});
   
//opens the dialog whenever one of the edit icons is clicked
    $
('a.updateDialog').on('click',  function(event) {
       
event.preventDefault();
       
//get url to load from the clicked link's href
       
var url = $(this).attr('href');


       
//tell jqueryUI to load the url & show it in the dialog
        $
('#edit_dialog').load(url, function() {
            $
('#edit_dialog').dialog('open');
       
});


   
});
});




</script>

views/demo/edit_loader.html


{{=loader}}

views/demo/edit_form.html
<h1>This is the default/edit_form.html template</h1>
{{=BEAUTIFY(response._vars)}}

Make sure you've got jQueryUI included somewhere in the page layout I just stuck it at the bottom of views/web2py_ajax.html
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" type="text/css" media="all" />


As far as the jGrowl part being displayed twice, it looks like changing my javascript ajax() call so that it does NOT include an ':eval' argument at the end fixed that.

Brian M

unread,
Dec 18, 2013, 5:21:43 PM12/18/13
to web...@googlegroups.com
Anybody have any ideas? This setup worked under older versions of web2py but not anymore - I assume something with the changes to web2py.js but don't know where.
Reply all
Reply to author
Forward
0 new messages