The last problematic script use to work if I use it with normal form (not a form in a component).
Richard On Fri, Nov 16, 2012 at 4:53 PM, Richard Vézina <[email protected] > wrote: > Will look at that. > > Thanks Niphlod. > > It is bizzard all my script work, but when I add this one they all stop > working, I thougth that it was because of web2py.js or bootstrap.js or > orther .js, but I don't think so now. > > # Works fine > response.js = 'jQuery(document).ready(function(){ > jQuery(".input_wrapper").has(".error").addClass("inputError"); > jQuery(".w2p_fw").has(".error").addClass("control-group error"); > jQuery(".w2p_fw").each(function(){ > $(this).find(".error_wrapper").appendTo(this); }); });' > response.js += 'jQuery(document).ready(function(){ > jQuery("textarea").elastic(); });' > response.js += '$(document).ready(function () { > $("[rel=tooltip]").tooltip(); });' > > # This one brake them all > response.js += 'jQuery(document).ready(function () { var date_format = > (typeof w2p_ajax_date_format != "undefined") ? w2p_ajax_date_format : > "%Y-%m-%d"; jQuery(".icon-calendar").click(function() { > Calendar.setup({inputField:jQuery(this).parent().prev().focus(), > ifFormat:date_format, showsTime:false }); > jQuery(this).parent().prev().trigger("onclick"); }); });' > > > By the way, those little js are pretty cool for someone who wants to use > bootstrap features like icon-calendar with "input-append add-on"... They > are mostly workaround I found to make work things rapidly before I find a > better solution to use bootstrap features. To use them someone has to use > widget to modify the class of the input field and set required bootstrap > class. > > Richard > > > On Fri, Nov 16, 2012 at 4:34 PM, Niphlod <[email protected]> wrote: > >> if you have the default layout bootstrap.js is put at the end of the page. >> trying to call something relying on that on a fragment that is put before >> the last piece of the page is loaded will obviously not run. >> and again, LOAD() (when not called with ajax=False) is just a nice >> shortcut to $.ajax . >> response.js allows you to have something called on a response, but you >> may embed the <script> on the returned component to get it executed as soon >> as it loads. >> >> >> -- >> >> >> >> > > --

