Bug with block__custom_javascripts()

A place for users and developers of the Xataface to discuss and receive support.

Bug with block__custom_javascripts()

Postby kevinwen » Thu Apr 15, 2010 10:38 am

I declare block__custom_javascripts() in the delegate class to include a javascript file just like the following:
Code: Select all
    function block__custom_javascripts(){
        echo '<script src="' . DATAFACE_SITE_URL . '/javascript/submithandler.js" type="text/javascript" language="javascript"></script>';
    }


This file includes the javascript code that needs to use JQuery framework and looks like the following:
Code: Select all
jQuery(document).ready(function($){
    $("input[type='submit']").click(function(){
        $(this).attr("disabled","disabled");
        $(this).closest("form").submit();
    });
});


This javascript file(/javascript/submithandler.js) is available while listing/viewing/editing records. However, the following javascript code is NOT available when listing records:

Code: Select all
<script type="text/javascript" src="/xataface/js/jquery-ui.packed.js"></script>


It then generate the javascirpt error looking like the following:

Can somebody fix this? My version is 1.2.2 1616. Thanks.
Attachments
js_error.jpg
js_error.jpg (18.77 KiB) Viewed 982 times
kevinwen
 
Posts: 109
Joined: Mon Dec 28, 2009 3:44 pm

Re: Bug with block__custom_javascripts()

Postby shannah » Thu Apr 15, 2010 11:04 am

jQuery is not actually loaded in every page load. It is included in the view and edit tabs I believe, but not all. You should include it in your custom_javascripts block if you want to guarantee its availability.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Bug with block__custom_javascripts()

Postby kevinwen » Thu Apr 15, 2010 2:20 pm

If JQuery is included in the custom_javascripts block, then it will be included twice when we touch the view/edit page. How do I use javascript code to make sure JQuery is loaded and loaded only once?
kevinwen
 
Posts: 109
Joined: Mon Dec 28, 2009 3:44 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 34 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved