[jQuery] Re: How to manipulate an object containaing HTML
On 1 oct, 20:07, Karl Swedberg k...@englishrules.com wrote: Sure, you can do this with html. Inside the success callback function, do this: $(html) .find(td) .css('padding-left','80px') .end() .appendTo('#myTable'); great! that's the .end() part i was missing! Thanks, i can now sleep nicely :) I agree with Charlie that it's a better idea to set the style with css and then just add a class to the td elements. Whether you do that server-side or in the success callback is up to you. This example was just for illustration purpose. What i need to do is more complicated than that and actually done by server-side scripting. I just wanted to understand exactly how jquery worked. Since when not specifiying the context (thus working with the current document DOM) it worked implicitly i was sure there was a way to get this done within a specified context. Also, you ought to append table rows to a tbody, not to a table. That's for sure, illustration purpose again :) Thanks to both of you for that help!
[jQuery] Re: IE7 does not play nice with $.load
2009/10/2 Dave Methvin dave.meth...@gmail.com: Is there some easy way of forcing IE to make ajax calls? You can use the old trick of adding a random number to the end of the url. That's what the { cache: false } option does; see jQuery 1.3.2 line 3448 onwards: if ( s.cache === false type == GET ) { var ts = now(); // try replacing _= if it is there var ret = s.url.replace(/(\?|)_=.*?(|$)/, $1_= + ts + $2); // if nothing was replaced, add timestamp to the end s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? : ?) + _= + ts : ); } Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/
[jQuery] Re: Superfish customization: change display height of submenu
That's great, thanks! I'm slowly starting to understand these hooks and callback etc. I have played around with it for a while, and finally changed the onBeforeShow in sf.defaults. I couldn't get it to work with just using your example, tried different locations of putting that code. This works fine, for now: sf.defaults = { hoverClass : 'sfHover', --snip-- onBeforeShow: function(){ // check window top of parent ul var ulOffset=$(this).parent().parent().offset().top; // check window offset of the parent li var liOffset=$(this).parent().offset().top; // adjust top position of sub by difference of offsets (this).css(top,(ulOffset-liOffset)) }, onShow : function(){}, onHide : function(){} }; I am curious where you think your example code should have gone. Is that in the html file HEAD section? Or somewhere else? Because I'm sure this is not the best way of handling it :-) Thanks again! Jacco On Oct 1, 4:00 pm, Charlie charlie...@gmail.com wrote: good plugins offer options to hook into events andsuperfishis one of those the submenus are all absolutely positioned to their parent . Insuperfishcss look for the li:hover ul, sfHover ul etc that reposition the sub to top=0 when visible. When not visible it has top=-999em InSuperfishAPI you will find an option onBeforeShow that allows you to create a function where this is the sub ul about to be displayed. Here a function to change the position of the sub can be created a simple method to align all the subs where all tops will be at top of overall menu is to first find position of the menu in window var menuOffset=$('ul.sf-menu').offset().top; // now you can use the menu container as reference point to align the other elements $('ul.sf-menu').superfish({ onBeforeShow: function(){ // check window offset of the parent li var offset=$(this).parent().offset().top // adjust top position of sub by difference of offsets $(this).css(top,(menuOffset-offset)) } }); good luck! Jacco wrote:Hi All, I am new to jQuery Superfish, but it seemd like the most logical way to do a quick prototype for a menusystem. I am trying to create a verertical menu system (usingsuperfish-vertical). However, I'd like to tweak the behaviour of the submenu, and have been unsuccessful so far. Here's what the current solution does (straight out of the box) - assume menu item 3 is hovered over: menu item 1 menu item 2 [ menu item 3 ] menu item 3.1 menu item 4 menu item 3.2 menu item 5 menu item 3.3 menu item 6 menu item 3.4 menu item 3.5 menu item 3.6 Normal, expected behaviour. But I would like to use this type of menu in a vertically restricted area, and therefore try to place the submenu in such a way that it still fits. I am aware of many restictions that apply when I go about this (submenu can never be more items than the main menu, for instance), but let's assume I can control that. So, I would like the submenu to take into accoutn the height of the available space. Two examples, for menu item 3 menu item 6: menu item 1 menu item 3.1 menu item 2 menu item 3.2 [ menu item 3 ] menu item 3.3 menu item 4 menu item 3.4 menu item 5 menu item 3.5 menu item 6 menu item 3.6 menu item 1 menu item 2 menu item 3 menu item 6.1 menu item 4 menu item 6.2 menu item 5 menu item 6.3 [ menu item 6 ] menu item 6.4 Is this possible? I cannot find the code that determines the top of the new div that is being displayed (probably due to my newness to jQuery Superfish). But any pointers would be greatly appreciated! Thanks in advance, Jacco
[jQuery] Re: [jquery-in-place-editor] Success function
2009/9/23 Cyril Lopez loveisthe...@gmail.com Hi I'm using Dave Hauenstein's Jquery in place editor ( http://code.google.com/p/jquery-in-place-editor/). I don't know how using the success function in order to display a message if server responds with a success. I tried with success : success: function(data,elem){ $(elem).html(data+'myMessage'); // return data+'myMessage' doesn't work } Is there a better way to display a custom message, replacing my input ? Thanks and sorry for my poor english. Cyril, Nethik Nobody already used the success function ? Thanks for any help Cyril, Nethik
[jQuery] (autocomplete) show selection list programatically
Hi, I'm using the autocomplete plugin: http://docs.jquery.com/Plugins/Autocomplete I'd like to trigger the display of the selection list from javascript, for example when an empty textarea get's focus, when a button on the page is clicked, etc.. Is there a way to call an internal function to trigger the display of the list? I've been at this for a little while now, with no sucess. Thanks in advance!
[jQuery] Re: how to replace all the '[]' to be '' in $.SortSerialize('MDEExportedList').hash
Thanks for all replies. i use replace(new RegExp(.\],g) to get it work. Thanks. On Fri, Oct 2, 2009 at 10:31 AM, Karl Swedberg k...@englishrules.comwrote: On Oct 1, 2009, at 5:34 PM, waseem sabjee wrote: heres an interesting way of doing var x = mystring.length; for(x; x 0; x--) { var s = mystring[x]; // if this character is an instance of the character you want to replace if(mystring.match(/[]/) // replace it mystring.replace(/[]/, replacement); } It might be interesting, but it seems like a lot of extra work. This can be done with a simple regex replace, as someone already mentioned: var newString = $.SortSerialize('MDEExportedList').hash.replace(/\[|\]/g,''); Not sure what $.SortSerialize('MDEExportedList').hash is all about, but the replace() function should work. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: jQuery UI Portlets Cookies
I have managed to find a script that will save the position of portlets, but to one column only - plus it wont allow me to connect to another column. I need to be able to drag over to other columns and save their order. Can anyone help? Here is my code... script type=text/javascript / / Set cookie for sidebar portlets // / // set the list selector var setSelector = .column; // set the cookie name var setCookieName = portletOrder; // set the cookie expiry time (days): var setCookieExpiry = 30; // function that writes the list order to a cookie function getOrder() { // save custom order to cookie $.cookie(setCookieName, $(setSelector).sortable(toArray), { expires: setCookieExpiry, path: / }); } // function that restores the list order from a cookie function restoreOrder() { var div = $(setSelector); if (div == null) return // fetch the cookie value (saved order) var cookie = $.cookie(setCookieName); if (!cookie) return; // make array from saved order var IDs = cookie.split(,); // fetch current order var items = div.sortable(toArray); // make array from current order var rebuild = new Array(); for ( var v=0, len=items.length; vlen; v++ ){ rebuild[items[v]] = items[v]; } for (var i = 0, n = IDs.length; i n; i++) { // item id from saved order var itemID = IDs[i]; if (itemID in rebuild) { // select item id from current order var item = rebuild[itemID]; // select the item according to current order var child = $(div.ui-sortable).children(# + item); // select the item according to the saved order var savedOrd = $(div.ui-sortable).children (# + itemID); // remove all the items child.remove(); // add the items in turn according to saved order we need to filter here since the ui-sortable // class is applied to all ul elements and we only want the very first! $(div.ui-sortable).filter(:first).append (savedOrd); } } } // code executed when the document loads $(function () { $(setSelector).sortable({ update: function() {getOrder(); } }); restoreOrder(); // here, we reload the saved order $(.portlet).addClass(ui-widget ui-widget-content ui- helper-clearfix ui-corner-all) .find(.portlet-header) .addClass(ui-widget-header ui-corner- all) .prepend('') .end() .find(.portlet-content); $(.portlet-header .ui-icon).click(function() { $(this).toggleClass(ui-icon-minus); $(this).toggleClass(ui-icon-plus); $(this).parents(.portlet:first).find (.portlet-content).toggle(); }); $(.portlet-header .ui-icon).hover( function() {$(this).addClass(ui-icon- hover); }, function() {$(this).removeClass('ui-icon- hover'); } ); }); /script /head div id=wideSidebar class=column div class=sidebarBox portlet id=item-1 h2 class=portlet-headerHeader 1/h2 fdssdsd /div div class=sidebarBox portlet id=item-2 h2 class=portlet-headerHeader 2/h2 fsdsdfsfsd /div div class=sidebarBox portlet id=item-3 h2 class=portlet-headerHeader 3/h2 div class=portlet-content fdsfsdfsdfsd/div /div /div div id=wideSidebar2 class=column div class=sidebarBox portlet id=item-4 h2 class=portlet-headerHeader 4/h2 ul class=guideListing portlet-content liContent 1 list/li /ul /div div class=sidebarBox portlet id=item-5 h2 class=portlet-headerHeader 5/h2 ul class=portlet-content liContent 2 list/li /ul /div div class=sidebarBox portlet id=item-6 h2 class=portlet-headerHeader 6/h2 div class=portlet-content Content 3 /div /div /div On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI (sortable) Portlets code - but I want to use the jQuery cookies plugin to remember the order of the portlets. I don't
[jQuery] How to disable a form
I want to disable a form when I submit it. The first reason is because I do not want the form submitted more as once. For this I could disable the submit button(s). But I also want the values not be changed during the submit. Is this possible? -- Cecil Westerhof
[jQuery] Re: keeping table header fix
On Sep 16, 2:16 am, macsig sigbac...@gmail.com wrote: Hello guys, I'd like to know if there is a way to keep a table header fixed on top of a div while I scroll the table rows. I am trying to do the same thing, but I'm debugging something else and I haven't succeeded yet. My approach has been that of the C coder that I am: -- give the header an id; make it display:none (works for me) -- at onload time, copy that header into another object that is displayable (the content shows up for me but I'm not so sure that the horizontal spacing -- between th/tds -- works right). Some things I found out: -- I cannot make /only/ the header tr behave the way I (and you) want -- and I cannot make thead work the way it's advertised: it wants to stay fixed vertically, but does not in FF3.5.3, IE7, or Safari. -- I do not make the displayable header position:fixed because the displayable header stays fixed /horizontally/ too: can't scroll the table left and right and expect that header to follow the body.. -- because no position:fixed, I have to handle vertical scrolling in JS code, which is what I'm working on right now. If I were a respectable JS coder, I believe I'd have these issues fixe^h^h^h^h corrected by now. But I'm just a JS beginner so taking baby steps. I would very much like to know how you approaching this problem. To see my developing solution: http://sellmycalls.com/cgi-bin/chain I hope this helps us both! -- Ben
[jQuery] Re: How To use getJSON?
Many Thanks @ All. Now it works and i have understood it! :) And the JSON validator is now in the favs. ;) On 2 Okt., 01:02, Colossus david.stoffe...@googlemail.com wrote: h...@all. I have a little problem with JQuery and JSON, because it's my first JSON testing Project. In the documentation i found this:http://docs.jquery.com/Ajax/jQuery.getJSON But i do not understand how it works with an JSON array. :( It's an other JSON structure then mine. I simply want to play around with it. And trying to load some images in a img src tag. ;) My jQuery Function is: $.getJSON(index.php?action=JSON_directory, function(data){ // and this is my prob, see my php result. }); }); php JSON (encoded) Result: [\/uploads\/Argentina.gif,\/uploads\/Australia.gif,\/uploads\/ Brazil.gif,\/uploads\/Cameroon.gif] Hope anyone can help a lame dog over a stile. ;) Many THX. :)
[jQuery] Re: How to disable a form
Cecil Westerhof ha scritto: I want to disable a form when I submit it. The first reason is because I do not want the form submitted more as once. For this I could disable the submit button(s). But I also want the values not be changed during the submit. Is this possible? On the beforesubmit event add the readonly attribute to every field. Should work.. :-) -- gianiaz.net - web solutions via piedo, 58 - 23020 tresivio (so) - italy +39 347 7196482
[jQuery] Problem with submit button of an inserted form
I have the following code: $(placeInDOM).replaceWith(header + fields + footer); $(placeInDOM).find(':submit').click(function() { alert(clicked the submit button); return false; }); The first statement places a form with a submit button in my page. This works as it should. With the second I want to give an alert instead of a submit when clicking on the submit button. But it does not work. When I after the first statement execute: alert($(placeInDOM).find(':submit').html()); I get null If I execute: alert($(placeInDOM).find(':submit')); I get: [object Object] What am I doing wrong? I found a workaround by using: $('.submit').click(function() { But this only works when my form is the only form on the page. So it is not very satisfactory. -- Cecil Westerhof
[jQuery] something missing from my code?
Hey guys, Im new to Javascript and JQuery, I am trying to have a featured area on the front page to my site, basically there is a right div area which holds the picture, on the left there is a menu with 4 buttons. here is the html: div id=projectmenu ul id=projMenu lia class=projOne title=Project1/a/li lia class=projTwo title=Project2/a/li lia class=projThree title=Project3/a/li lia class=projFour title=Project4/a/li /ul /div div class=project id=project1/div div class=project id=project2/div div class=project id=project3/div div class=project id=project4/div /div Here is the way im setting up the JQuery to try and make the active div change when I choose a button: $(function() { $('a projTwo').click(function() { $('#project1').css('display','none'); $('#project2').css ('display',''); }); }); does anyone see where I am going wrong? when I get into the CSS portion will it have to go all the way back like how css is written? meaning in order to identify it, would it have to be #container #project1 or will just #project1 work? thank you in advance
[jQuery] Re: How to disable a form
2009/10/2 Giovanni Battista Lenoci gian...@gmail.com: I want to disable a form when I submit it. The first reason is because I do not want the form submitted more as once. For this I could disable the submit button(s). But I also want the values not be changed during the submit. Is this possible? On the beforesubmit event add the readonly attribute to every field. Should work.. :-) There is not a better way? When something goes wrong, I want to enable the form again. When there allready are readonly fields, this could complicate matters. -- Cecil Westerhof
[jQuery] Re: How to disable a form
On Fri, Oct 2, 2009 at 8:32 AM, Giovanni Battista Lenoci gian...@gmail.com wrote: Cecil Westerhof ha scritto: I want to disable a form when I submit it. The first reason is because I do not want the form submitted more as once. For this I could disable the submit button(s). But I also want the values not be changed during the submit. Is this possible? On the beforesubmit event add the readonly attribute to every field. Should work.. :-) I like that idea but another might be to (after the form has submitted) add a new submit handler for the form that simply returned false.
[jQuery] Re: Stumped. 1.3.2 breaks this script
Article: http://blog.reindel.com/2007/02/02/use-jquery-expressions-and-ajax-to-browse-an-xml-file/ Example: http://blog.reindel.com/src/jquery_browse Script: http://blog.reindel.com/src/jquery_browse/browse.js I've also emailed the author with no response. A quick peek, anyone? Bueller? Bueller?? On Oct 1, 7:53 pm, stilfx sti...@gmail.com wrote: I was reviewing this post..http://blog.reindel.com/2007/02/02/use-jquery-expressions-and-ajax-to... ..on browsing an XML file with jQuery (a great learn, btw). I'm trying to use the same script, except updated to jQuery 1.3.2 - but it's not initially showing the first few books. I'm not sure what version of jQuery the example was written with, but its older, and works. Example:http://blog.reindel.com/src/jquery_browse/ I think I have it narrowed down to an issue with this filter: .filter(:gt( + parseInt(curPos - 1) + )) Give a shout if you have any insite as to the issue. I'm trying to fig it out but am stuck..
[jQuery] Re: How to disable a form
2009/10/2 brian bally.z...@gmail.com: On Fri, Oct 2, 2009 at 8:32 AM, Giovanni Battista Lenoci gian...@gmail.com wrote: Cecil Westerhof ha scritto: I want to disable a form when I submit it. The first reason is because I do not want the form submitted more as once. For this I could disable the submit button(s). But I also want the values not be changed during the submit. Is this possible? On the beforesubmit event add the readonly attribute to every field. Should work.. :-) I like that idea but another might be to (after the form has submitted) add a new submit handler for the form that simply returned false. The problem with that is that the fields still can be changed. I prefer that this is not possible. A simple method would be to hide the form. But that is not very pleasing to the eyes I am afraid. -- Cecil Westerhof
[jQuery] Re: How to disable a form
On Fri, Oct 2, 2009 at 9:11 AM, Cecil Westerhof cldwester...@gmail.com wrote: 2009/10/2 brian bally.z...@gmail.com: I like that idea but another might be to (after the form has submitted) add a new submit handler for the form that simply returned false. The problem with that is that the fields still can be changed. I prefer that this is not possible. A simple method would be to hide the form. But that is not very pleasing to the eyes I am afraid. I suppose it depends on the interface you're working with. Perhaps you could fade the form out and display, in its place, a thank you (or whatever) message. If something goes wrong you could re-display the form.
[jQuery] Re: something missing from my code?
also instead of $('#project1').css('display','none'); $('#project2').css('display',''); it's better habit to use .hide() and .show(), which gives you more options (like animation effects if you want) as well as automatically handles different show/hide code needed for different types of DOM objects On Oct 2, 9:00 am, Glen_H glen.f.he...@gmail.com wrote: Hey guys, Im new to Javascript and JQuery, I am trying to have a featured area on the front page to my site, basically there is a right div area which holds the picture, on the left there is a menu with 4 buttons. here is the html: div id=projectmenu ul id=projMenu lia class=projOne title=Project1/a/li lia class=projTwo title=Project2/a/li lia class=projThree title=Project3/a/li lia class=projFour title=Project4/a/li /ul /div div class=project id=project1/div div class=project id=project2/div div class=project id=project3/div div class=project id=project4/div /div Here is the way im setting up the JQuery to try and make the active div change when I choose a button: $(function() { $('a projTwo').click(function() { $('#project1').css('display','none'); $('#project2').css ('display',''); }); }); does anyone see where I am going wrong? when I get into the CSS portion will it have to go all the way back like how css is written? meaning in order to identify it, would it have to be #container #project1 or will just #project1 work? thank you in advance
[jQuery] Re: something missing from my code?
When you write: $('a projTwo').click(function() { You want to identify the correct a by its class name (projTwo). So you would want to write it as: $('a.projTwo').click(function() { Notice the difference? On 2 Okt, 15:00, Glen_H glen.f.he...@gmail.com wrote: Hey guys, Im new to Javascript and JQuery, I am trying to have a featured area on the front page to my site, basically there is a right div area which holds the picture, on the left there is a menu with 4 buttons. here is the html: div id=projectmenu ul id=projMenu lia class=projOne title=Project1/a/li lia class=projTwo title=Project2/a/li lia class=projThree title=Project3/a/li lia class=projFour title=Project4/a/li /ul /div div class=project id=project1/div div class=project id=project2/div div class=project id=project3/div div class=project id=project4/div /div Here is the way im setting up the JQuery to try and make the active div change when I choose a button: $(function() { $('a projTwo').click(function() { $('#project1').css('display','none'); $('#project2').css ('display',''); }); }); does anyone see where I am going wrong? when I get into the CSS portion will it have to go all the way back like how css is written? meaning in order to identify it, would it have to be #container #project1 or will just #project1 work? thank you in advance
[jQuery] Re: IE7 does not play nice with $.load
On Fri, Oct 2, 2009 at 5:00 AM, Nick Fitzsimons n...@nickfitz.co.uk wrote: 2009/10/2 Dave Methvin dave.meth...@gmail.com: Is there some easy way of forcing IE to make ajax calls? You can use the old trick of adding a random number to the end of the url. That's what the { cache: false } option does; see jQuery 1.3.2 line 3448 onwards: if ( s.cache === false type == GET ) { var ts = now(); // try replacing _= if it is there var ret = s.url.replace(/(\?|)_=.*?(|$)/, $1_= + ts + $2); // if nothing was replaced, add timestamp to the end s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? : ?) + _= + ts : ); } Could someone please explain to me the significance of _= in the URL?
[jQuery] Re: keeping table header fix
On Thu, 2009-10-01 at 22:25 -0400, Karl Swedberg wrote: have you tried overflow-y: auto; ? This works... (to some degree) table tbody { height: 799px; overflow-y: auto; overflow-x: hidden; } Cheers, -- Matt Zagrabelny - mzagr...@d.umn.edu - (218) 726 8844 University of Minnesota Duluth Information Technology Systems Services PGP key 1024D/84E22DA2 2005-11-07 Fingerprint: 78F9 18B3 EF58 56F5 FC85 C5CA 53E7 887F 84E2 2DA2 He is not a fool who gives up what he cannot keep to gain what he cannot lose. -Jim Elliot
[jQuery] Re: Stumped. 1.3.2 breaks this script
You say it's not displaying the first few books but you don't say which those are. The first one I'm seeing is Plum Lovin'. Is that correct or not? FF3.5.3/Linux, btw. On Fri, Oct 2, 2009 at 9:04 AM, stilfx sti...@gmail.com wrote: Article: http://blog.reindel.com/2007/02/02/use-jquery-expressions-and-ajax-to-browse-an-xml-file/ Example: http://blog.reindel.com/src/jquery_browse Script: http://blog.reindel.com/src/jquery_browse/browse.js I've also emailed the author with no response. A quick peek, anyone? Bueller? Bueller?? On Oct 1, 7:53 pm, stilfx sti...@gmail.com wrote: I was reviewing this post..http://blog.reindel.com/2007/02/02/use-jquery-expressions-and-ajax-to... ..on browsing an XML file with jQuery (a great learn, btw). I'm trying to use the same script, except updated to jQuery 1.3.2 - but it's not initially showing the first few books. I'm not sure what version of jQuery the example was written with, but its older, and works. Example:http://blog.reindel.com/src/jquery_browse/ I think I have it narrowed down to an issue with this filter: .filter(:gt( + parseInt(curPos - 1) + )) Give a shout if you have any insite as to the issue. I'm trying to fig it out but am stuck..
[jQuery] Re: Stumped. 1.3.2 breaks this script
On Fri, Oct 2, 2009 at 9:29 AM, brian bally.z...@gmail.com wrote: You say it's not displaying the first few books but you don't say which those are. The first one I'm seeing is Plum Lovin'. Is that correct or not? FF3.5.3/Linux, btw. Never mind,I just found the XML source. Plum Lovin' is, indeed, the first book on the list. http://blog.reindel.com/src/jquery_browse/books.xml
[jQuery] Re: jQuery UI Portlets Cookies
anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI (sortable) Portlets code - but I want to use the jQuery cookies plugin to remember the order of the portlets. I don't know where to start - and searching the net for an answer only brings up sortable ul and li. Please help. Code: script type=text/javascript $(function() { $(.column).sortable({ connectWith: '.column' }); $(.column).disableSelection(); }); /script HTML: div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div
[jQuery] Re: How to disable a form
2009/10/2 brian bally.z...@gmail.com: On Fri, Oct 2, 2009 at 9:11 AM, Cecil Westerhof cldwester...@gmail.com wrote: 2009/10/2 brian bally.z...@gmail.com: I like that idea but another might be to (after the form has submitted) add a new submit handler for the form that simply returned false. The problem with that is that the fields still can be changed. I prefer that this is not possible. A simple method would be to hide the form. But that is not very pleasing to the eyes I am afraid. I suppose it depends on the interface you're working with. Perhaps you could fade the form out and display, in its place, a thank you (or whatever) message. If something goes wrong you could re-display the form. That was what I am thinking about for lack of something better. I would prefer to hide it only after a succesfull submit. But I expect it to be mostly succesfull. So it is acceptable. -- Cecil Westerhof
[jQuery] Re: Stumped. 1.3.2 breaks this script
Let me clarify. This example is working, using the older version of jQuery. When I plug in jQuery 1.3.2, the first two books no longer show and it breaks the script a bit. I am trying to figure out what changed. Near the end of the script (browse.js) you will find: .filter(:gt( + parseInt(curPos - 1) + )) I believe this is where the issue lies, but cannot seem to figure it out from there. Thanks for looking into it!! On Oct 2, 9:31 am, brian bally.z...@gmail.com wrote: On Fri, Oct 2, 2009 at 9:29 AM, brian bally.z...@gmail.com wrote: You say it's not displaying the first few books but you don't say which those are. The first one I'm seeing is Plum Lovin'. Is that correct or not? FF3.5.3/Linux, btw. Never mind,I just found the XML source. Plum Lovin' is, indeed, the first book on the list. http://blog.reindel.com/src/jquery_browse/books.xml
[jQuery] Re: jQuery UI Portlets Cookies
Hello Craig, I've done this before by building up a string e.g. box- id1,collapsed;box-id5,not-collapsed;box-id3,collapsed|box- id4,collapsed;box-id2,not-collapsed;box-id6,collapsed; In the javascript do something like this http://pastebin.com/m90a2af6 Hope this helps, Nalum On Oct 2, 2:35 pm, craigeves craige...@googlemail.com wrote: anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI (sortable) Portlets code - but I want to use the jQuery cookies plugin to remember the order of the portlets. I don't know where to start - and searching the net for an answer only brings up sortable ul and li. Please help. Code: script type=text/javascript $(function() { $(.column).sortable({ connectWith: '.column' }); $(.column).disableSelection(); }); /script HTML: div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div
[jQuery] Re: jQuery UI Portlets Cookies
Thanks for this - but I don't understand where it would fit into my script? I'm only just starting in jQuery... Also, will this save the position of the portlet no matter which column it's in? It's just that it looks like it's related to a closed and expanded portlet state. Thanks for your time. Craig On Oct 2, 2:58 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, I've done this before by building up a string e.g. box- id1,collapsed;box-id5,not-collapsed;box-id3,collapsed|box- id4,collapsed;box-id2,not-collapsed;box-id6,collapsed; In the javascript do something like thishttp://pastebin.com/m90a2af6 Hope this helps, Nalum On Oct 2, 2:35 pm, craigeves craige...@googlemail.com wrote: anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI (sortable) Portlets code - but I want to use the jQuery cookies plugin to remember the order of the portlets. I don't know where to start - and searching the net for an answer only brings up sortable ul and li. Please help. Code: script type=text/javascript $(function() { $(.column).sortable({ connectWith: '.column' }); $(.column).disableSelection(); }); /script HTML: div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div
[jQuery] Re: How to disable a form
This is a nice plugin that I've come across that I think would be able to do exactly what you want. http://malsup.com/jquery/block/ Nalum On Oct 2, 2:35 pm, Cecil Westerhof cldwester...@gmail.com wrote: 2009/10/2 brian bally.z...@gmail.com: On Fri, Oct 2, 2009 at 9:11 AM, Cecil Westerhof cldwester...@gmail.com wrote: 2009/10/2 brian bally.z...@gmail.com: I like that idea but another might be to (after the form has submitted) add a new submit handler for the form that simply returned false. The problem with that is that the fields still can be changed. I prefer that this is not possible. A simple method would be to hide the form. But that is not very pleasing to the eyes I am afraid. I suppose it depends on the interface you're working with. Perhaps you could fade the form out and display, in its place, a thank you (or whatever) message. If something goes wrong you could re-display the form. That was what I am thinking about for lack of something better. I would prefer to hide it only after a succesfull submit. But I expect it to be mostly succesfull. So it is acceptable. -- Cecil Westerhof
[jQuery] Re: jQuery UI Portlets Cookies
Is the code in the original post all the code you have? On Oct 2, 3:03 pm, craigeves craige...@googlemail.com wrote: Thanks for this - but I don't understand where it would fit into my script? I'm only just starting in jQuery... Also, will this save the position of the portlet no matter which column it's in? It's just that it looks like it's related to a closed and expanded portlet state. Thanks for your time. Craig On Oct 2, 2:58 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, I've done this before by building up a string e.g. box- id1,collapsed;box-id5,not-collapsed;box-id3,collapsed|box- id4,collapsed;box-id2,not-collapsed;box-id6,collapsed; In the javascript do something like thishttp://pastebin.com/m90a2af6 Hope this helps, Nalum On Oct 2, 2:35 pm, craigeves craige...@googlemail.com wrote: anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI (sortable) Portlets code - but I want to use the jQuery cookies plugin to remember the order of the portlets. I don't know where to start - and searching the net for an answer only brings up sortable ul and li. Please help. Code: script type=text/javascript $(function() { $(.column).sortable({ connectWith: '.column' }); $(.column).disableSelection(); }); /script HTML: div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div
[jQuery] Re: jQuery UI Portlets Cookies
Here it is - thanks for your help again !doctype html html lang=en head titlejQuery UI Sortable - Portlets/title script type=text/javascript src=jquery-1.3.2.js/script script type=text/javascript src=ui.core.js/script script type=text/javascript src=ui.sortable.js/script style type=text/css .column { width: 300px; float: left; background-color: #ee; margin-right: 25px; padding-top: 10px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; height: 700px; } .portlet { background-color: #FFF; margin-top: 0; margin-right: 0; margin-bottom: 10; margin-left: 0; } .portlet-header { margin: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; background-color: #333; padding: 10px; color: #FFF; } .portlet-header .ui-icon { float: right; } .portlet-content { padding: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; color: #333; margin-bottom: 10px; } .ui-sortable-placeholder { border: 1px dotted black; visibility: visible} .ui-sortable-placeholder * { visibility: hidden; } /style script type=text/javascript $(function() { $(.column).sortable({ handle: '.portlet-header', connectWith: '.column' }); $(.column).disableSelection(); }); /script /head body div class=demo div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div psddfds/p /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div /div /body /html On Oct 2, 3:09 pm, Nalum mallon.l...@gmail.com wrote: Is the code in the original post all the code you have? On Oct 2, 3:03 pm, craigeves craige...@googlemail.com wrote: Thanks for this - but I don't understand where it would fit into my script? I'm only just starting in jQuery... Also, will this save the position of the portlet no matter which column it's in? It's just that it looks like it's related to a closed and expanded portlet state. Thanks for your time. Craig On Oct 2, 2:58 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, I've done this before by building up a string e.g. box- id1,collapsed;box-id5,not-collapsed;box-id3,collapsed|box- id4,collapsed;box-id2,not-collapsed;box-id6,collapsed; In the javascript do something like thishttp://pastebin.com/m90a2af6 Hope this helps, Nalum On Oct 2, 2:35 pm, craigeves craige...@googlemail.com wrote: anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI (sortable) Portlets code - but I want to use the jQuery cookies plugin to remember the order of the portlets. I don't know where to start - and searching the net for an answer only brings up sortable ul and li. Please help. Code: script type=text/javascript $(function() { $(.column).sortable({ connectWith: '.column' }); $(.column).disableSelection(); }); /script HTML: div class=column div
[jQuery] Re: How to disable a form
2009/10/2 Nalum mallon.l...@gmail.com: This is a nice plugin that I've come across that I think would be able to do exactly what you want. http://malsup.com/jquery/block/ I think that that is what I need. The only 'problem' is that it blocks the whole page and not only the form. But I can live with that. -- Cecil Westerhof
[jQuery] Re: IE7 does not play nice with $.load
2009/10/2 brian bally.z...@gmail.com: On Fri, Oct 2, 2009 at 5:00 AM, Nick Fitzsimons n...@nickfitz.co.uk wrote: 2009/10/2 Dave Methvin dave.meth...@gmail.com: Is there some easy way of forcing IE to make ajax calls? You can use the old trick of adding a random number to the end of the url. That's what the { cache: false } option does; see jQuery 1.3.2 line 3448 onwards: if ( s.cache === false type == GET ) { var ts = now(); // try replacing _= if it is there var ret = s.url.replace(/(\?|)_=.*?(|$)/, $1_= + ts + $2); // if nothing was replaced, add timestamp to the end s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? : ?) + _= + ts : ); } Could someone please explain to me the significance of _= in the URL? It doesn't really have any significance as such, it's just a throwaway name. In order to break browser caching, something needs to be added to the query string which wasn't present on any previous request from the same browser, and jQuery uses the current time in milliseconds since the epoch date. A query string might already be present, with various name-value pairs representing form elements (e.g. http://example.com/foo?id=1bar=baz). However, there is very little chance somebody has a form element named _, so that is used as the name for the otherwise-irrelevant timestamp used to break caching; in the previous example, the URL would change to something like http://example.com/foo?id=1bar=baz_=987654321. The only circumstances in which this could break is if somebody already has a form element named _, in which case the behaviour of the server when faced with two values for the same field is implementation-dependent (it's best if it makes an array of them, but PHP for example is broken in this regard); or if an over-eager server-side developer throws a validation error on encountering a field they weren't expecting, in which case said developer should be sent off to grow turnips for a living instead. Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/
[jQuery] Show/hide effect div on mouseover
Hi, I have a CSS menu that I created using div that current appears using the hover function in the CSS. What I would like to do is incorporate javascript to utilise the effect of fading in when the mouse moves over the 'menu' text and then with a delay fades out when the mouse moves out of the menu area. Is this possible? Please advise... Thanks
[jQuery] Re: is(':checked') always returns false
On Oct 1, 1:16 pm, bob.nel...@gmail.com bob.nel...@gmail.com wrote: I have a bunch of checkboxes that I want to have checked when the user checks a master checkbox. You are writing too much unnecessary jQuery code! HTML for master checkbox (within a container with id 'msgsInbox'): input id=msgCheckAllInbox name=msgCheckboxAllInbox type=checkbox value= onclick=checkAllMsgsIn() tabindex=-1 / Try: onclick=checkAllMsgsIn(this) Then: function checkAllMsgsIn() { alert($('#msgCheckAllInbox').is(:checked)); //Used to debug this $('#msgsInbox input.messageCheckbox').attr('checked', $ ('#msgCheckAllInbox').is(':checked')); function checkAllMsgsIn(cb) { $('#msgsInbox input.messageCheckbox').attr('checked', cb.checked); } Much simpler. Matt Kruse
[jQuery] Re: IE7 does not play nice with $.load
On Fri, Oct 2, 2009 at 10:23 AM, Nick Fitzsimons n...@nickfitz.co.uk wrote: 2009/10/2 brian bally.z...@gmail.com: On Fri, Oct 2, 2009 at 5:00 AM, Nick Fitzsimons n...@nickfitz.co.uk wrote: 2009/10/2 Dave Methvin dave.meth...@gmail.com: Is there some easy way of forcing IE to make ajax calls? You can use the old trick of adding a random number to the end of the url. That's what the { cache: false } option does; see jQuery 1.3.2 line 3448 onwards: if ( s.cache === false type == GET ) { var ts = now(); // try replacing _= if it is there var ret = s.url.replace(/(\?|)_=.*?(|$)/, $1_= + ts + $2); // if nothing was replaced, add timestamp to the end s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? : ?) + _= + ts : ); } Could someone please explain to me the significance of _= in the URL? It doesn't really have any significance as such, it's just a throwaway name. In order to break browser caching, something needs to be added to the query string which wasn't present on any previous request from the same browser, and jQuery uses the current time in milliseconds since the epoch date. A query string might already be present, with various name-value pairs representing form elements (e.g. http://example.com/foo?id=1bar=baz). However, there is very little chance somebody has a form element named _, so that is used as the name for the otherwise-irrelevant timestamp used to break caching; in the previous example, the URL would change to something like http://example.com/foo?id=1bar=baz_=987654321. The only circumstances in which this could break is if somebody already has a form element named _, in which case the behaviour of the server when faced with two values for the same field is implementation-dependent (it's best if it makes an array of them, but PHP for example is broken in this regard); or if an over-eager server-side developer throws a validation error on encountering a field they weren't expecting, in which case said developer should be sent off to grow turnips for a living instead. Thanks, Nick. Yes, that seems like a very good approach.
[jQuery] Re: jQuery UI Portlets Cookies
Hello Craig, When you need to show code you should try using a site like http://pastebin.com as it'll make it easier to read and your post wont be so long. You'll need to be able to work with cookies, I would suggest this jquery plugin http://plugins.jquery.com/project/cookie. I've explained how it works in this code here http://pastebin.com/m2c0e0bde. Hope this helps you out. Nalum On Oct 2, 3:15 pm, craigeves craige...@googlemail.com wrote: Here it is - thanks for your help again !doctype html html lang=en head titlejQuery UI Sortable - Portlets/title script type=text/javascript src=jquery-1.3.2.js/script script type=text/javascript src=ui.core.js/script script type=text/javascript src=ui.sortable.js/script style type=text/css .column { width: 300px; float: left; background-color: #ee; margin-right: 25px; padding-top: 10px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; height: 700px;} .portlet { background-color: #FFF; margin-top: 0; margin-right: 0; margin-bottom: 10; margin-left: 0;} .portlet-header { margin: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; background-color: #333; padding: 10px; color: #FFF;} .portlet-header .ui-icon { float: right; } .portlet-content { padding: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; color: #333; margin-bottom: 10px;} .ui-sortable-placeholder { border: 1px dotted black; visibility: visible} .ui-sortable-placeholder * { visibility: hidden; } /style script type=text/javascript $(function() { $(.column).sortable({ handle: '.portlet-header', connectWith: '.column' }); $(.column).disableSelection(); }); /script /head body div class=demo div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div psddfds/p /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div /div /body /html On Oct 2, 3:09 pm, Nalum mallon.l...@gmail.com wrote: Is the code in the original post all the code you have? On Oct 2, 3:03 pm, craigeves craige...@googlemail.com wrote: Thanks for this - but I don't understand where it would fit into my script? I'm only just starting in jQuery... Also, will this save the position of the portlet no matter which column it's in? It's just that it looks like it's related to a closed and expanded portlet state. Thanks for your time. Craig On Oct 2, 2:58 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, I've done this before by building up a string e.g. box- id1,collapsed;box-id5,not-collapsed;box-id3,collapsed|box- id4,collapsed;box-id2,not-collapsed;box-id6,collapsed; In the javascript do something like thishttp://pastebin.com/m90a2af6 Hope this helps, Nalum On Oct 2, 2:35 pm, craigeves craige...@googlemail.com wrote: anyone? On Oct 2, 12:08 am, craigeves craige...@googlemail.com wrote: Please can someone help? I am using the jQuery UI
[jQuery] Re: How to disable a form
If you look at the examples you can set it to block just a specified element. On Oct 2, 3:19 pm, Cecil Westerhof cldwester...@gmail.com wrote: 2009/10/2 Nalum mallon.l...@gmail.com: This is a nice plugin that I've come across that I think would be able to do exactly what you want. http://malsup.com/jquery/block/ I think that that is what I need. The only 'problem' is that it blocks the whole page and not only the form. But I can live with that. -- Cecil Westerhof
[jQuery] Block access to the page but unblock certains divs
Hi, Is it possible to block the entire page but then override certain divs with an unblock command? Basically, I want to implement the block function when someone clicks the submit button on a form but if they have missed a question then unblock just this question div so it's nice and clear that's the one they need to correct? Thanks.
[jQuery] validate
I am having a problem getting the error container to clear out after I have fixed invalid inputs. I am using the invalidHandler option. When my form is invalid it shows a message of the number of errors (taken from the sample code) and shows the invalid messages. After I correct each error the corresponding message goes away but I am still left with the message of the number of errors. Here is my setup. Can you tell me what might be wrong? Thanks $(#aspnetForm).validate({ focusCleanup: true, onfocusout: false, onkeyup: false, submitHandler: function(form) { saveAnnouncement(); return false; }, invalidHandler: function(form, validator) { var errors = validator.numberOfInvalids(); if (errors) { var message = errors == 1 ? 'You missed 1 field. It has been highlighted.' : 'You missed ' + errors + ' fields. They have been highlighted.'; $(div.error span).html(message); $(div.error).show(); } else { $(div.error).hide(); } }, errorContainer: div.error, errorLabelContainer: div.error div, wrapper: p, rules: { txtStartDate: { required: true, date: true, isDate: true }, txtEndDate: { required: true, date: true, isDate: true, endDateCheck: true }, txtHeading: { required: true }, txtMessage: { required: true } }, messages: { txtStartDate: { required: * The start date is required., date: * The start date is not a valid date format., isDate: * The start date is not a valid date. }, txtEndDate: { required: * The end date is required., date: * The end date is not a valid date format., isDate: * The end date is not a valid date., endDateCheck: * The end date must be greater than or equal to the start date. }, txtHeading: { required: * The heading is required. }, txtMessage: { required: * The message is required. } } });
[jQuery] Re: Block access to the page but unblock certains divs
Have a look at he last posts in this thread. http://groups.google.com/group/jquery-en/browse_thread/thread/a174d8c1fdebad65 On Oct 2, 3:32 pm, samh12 ste...@bluemania.co.uk wrote: Hi, Is it possible to block the entire page but then override certain divs with an unblock command? Basically, I want to implement the block function when someone clicks the submit button on a form but if they have missed a question then unblock just this question div so it's nice and clear that's the one they need to correct? Thanks.
[jQuery] Re: Block access to the page but unblock certains divs
Hi Nalum, Idon't think that answers my question. I know I can block at page and element level however I want a mixture. I want to block the page but leave the element that's in error alone i.e. $(document).ready(function() { $('#btnSubmit').click(function() { $.blockUI({ message: null }); $('#form_surname').unblock(); //now unblock the surname field as this needs correcting $('.blockOverlay').attr('title','Click to unblock').click($.unblockUI); }); }); Thanks.
[jQuery] Re: Troubles altering dropdown menu code..
Here is the code that I'm thinking needs to be altered: var timer; $(#menu li a).hover(function(){ $(this).parent().children(ul).slideDown(); }, function(){ var list = $(#menu ul:visible); timer = setTimeout(function(){ list.slideUp(); },200); }); $(#menu li ul li).hover(function(){ clearTimeout(timer); }, function(){ var list = $(#menu ul:visible); timer = setTimeout(function(){ list.slideUp(); },200); });
[jQuery] Re: Problem with submit button of an inserted form
Cecil Westerhof ha scritto: I have the following code: $(placeInDOM).replaceWith(header + fields + footer); $(placeInDOM).find(':submit').click(function() { alert(clicked the submit button); return false; }); The first statement places a form with a submit button in my page. This works as it should. With the second I want to give an alert instead of a submit when clicking on the submit button. But it does not work. When I after the first statement execute: alert($(placeInDOM).find(':submit').html()); I get null This is right, cause a subimit button doesn't have html in it... If I execute: alert($(placeInDOM).find(':submit')); I get: [object Object] What am I doing wrong? Try using console.log of firebug to see if the returned object contains what you're expecting. A question, what placeInDOM contains? is an id? the html you're replacing contains the id? Bye -- gianiaz.net - web solutions via piedo, 58 - 23020 tresivio (so) - italy +39 347 7196482
[jQuery] Re: jQuery UI Portlets Cookies
Hi Nalum I have tried and amended the code as you suggested - but still no luck? Thanks for the tip (pastebin). Here is my full code now. Please would you take a quick look and let me know where im going wrong? http://pastebin.com/m4dab8bb2 Thanks for your help in this - it's really appreciated! Craig On Oct 2, 3:40 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, When you need to show code you should try using a site likehttp://pastebin.com as it'll make it easier to read and your post wont be so long. You'll need to be able to work with cookies, I would suggest this jquery pluginhttp://plugins.jquery.com/project/cookie. I've explained how it works in this code herehttp://pastebin.com/m2c0e0bde. Hope this helps you out. Nalum On Oct 2, 3:15 pm, craigeves craige...@googlemail.com wrote: Here it is - thanks for your help again !doctype html html lang=en head titlejQuery UI Sortable - Portlets/title script type=text/javascript src=jquery-1.3.2.js/script script type=text/javascript src=ui.core.js/script script type=text/javascript src=ui.sortable.js/script style type=text/css .column { width: 300px; float: left; background-color: #ee; margin-right: 25px; padding-top: 10px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; height: 700px;} .portlet { background-color: #FFF; margin-top: 0; margin-right: 0; margin-bottom: 10; margin-left: 0;} .portlet-header { margin: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; background-color: #333; padding: 10px; color: #FFF;} .portlet-header .ui-icon { float: right; } .portlet-content { padding: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; color: #333; margin-bottom: 10px;} .ui-sortable-placeholder { border: 1px dotted black; visibility: visible} .ui-sortable-placeholder * { visibility: hidden; } /style script type=text/javascript $(function() { $(.column).sortable({ handle: '.portlet-header', connectWith: '.column' }); $(.column).disableSelection(); }); /script /head body div class=demo div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div psddfds/p /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div /div /body /html On Oct 2, 3:09 pm, Nalum mallon.l...@gmail.com wrote: Is the code in the original post all the code you have? On Oct 2, 3:03 pm, craigeves craige...@googlemail.com wrote: Thanks for this - but I don't understand where it would fit into my script? I'm only just starting in jQuery... Also, will this save the position of the portlet no matter which column it's in? It's just that it looks like it's related to a closed and expanded portlet state. Thanks for your time. Craig On Oct 2, 2:58 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, I've done
[jQuery] Re: How to disable a form
2009/10/2 Nalum mallon.l...@gmail.com: If you look at the examples you can set it to block just a specified element. I did not look good enough then. Thanks. At the moment I am working with hide and show. But when the functionality I want is 'ready' I'll implement it. -- Cecil Westerhof
[jQuery] Re: How to disable text inputs lying near checkboxes ?
Karl, Your explanation and also you code helped me make a big step forward in my understanding of how jQuery thinks. Your code works fine; I tested both solutions. Thanks a lot. Julien
[jQuery] Re: jQuery Navigation problems
well I hide the DIV with CSS visibility: hidden; and with jQuery I want to change the stylesheet and remove the visibility to visible, the problem I am having I am not that familiar with jQuery to know how to do that On Oct 1, 10:41 pm, Scooby scoob...@gmail.com wrote: How are you hiding your UL's? From my experience, hiding them with css is faster than jQuery.. I just hide them using both.. Seems to work fine for me.. On Oct 1, 8:41 pm, ZKM zachschnei...@gmail.com wrote: I have a website that has very large UL navigation created with jQuery and every time you goto the page it flashes the entire UL for a split of a second. So what I want to do is find a way to make it to do I think is hide the UL until the CSS and jQuery is loaded than display the menu. If anyone has a better idea I am all ears and I am also new to jQuery but catching on fast.
[jQuery] Re: jQuery UI Portlets Cookies
I've updated the javascript here. http://pastebin.com/m4caef476 If you need any help in understanding whats happening here let me know and I'll try to explain it, I'm not the best at explaining things though. Nalum On Oct 2, 4:06 pm, craigeves craige...@googlemail.com wrote: Hi Nalum I have tried and amended the code as you suggested - but still no luck? Thanks for the tip (pastebin). Here is my full code now. Please would you take a quick look and let me know where im going wrong? http://pastebin.com/m4dab8bb2 Thanks for your help in this - it's really appreciated! Craig On Oct 2, 3:40 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, When you need to show code you should try using a site likehttp://pastebin.com as it'll make it easier to read and your post wont be so long. You'll need to be able to work with cookies, I would suggest this jquery pluginhttp://plugins.jquery.com/project/cookie. I've explained how it works in this code herehttp://pastebin.com/m2c0e0bde. Hope this helps you out. Nalum On Oct 2, 3:15 pm, craigeves craige...@googlemail.com wrote: Here it is - thanks for your help again !doctype html html lang=en head titlejQuery UI Sortable - Portlets/title script type=text/javascript src=jquery-1.3.2.js/script script type=text/javascript src=ui.core.js/script script type=text/javascript src=ui.sortable.js/script style type=text/css .column { width: 300px; float: left; background-color: #ee; margin-right: 25px; padding-top: 10px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; height: 700px;} .portlet { background-color: #FFF; margin-top: 0; margin-right: 0; margin-bottom: 10; margin-left: 0;} .portlet-header { margin: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; background-color: #333; padding: 10px; color: #FFF;} .portlet-header .ui-icon { float: right; } .portlet-content { padding: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; color: #333; margin-bottom: 10px;} .ui-sortable-placeholder { border: 1px dotted black; visibility: visible} .ui-sortable-placeholder * { visibility: hidden; } /style script type=text/javascript $(function() { $(.column).sortable({ handle: '.portlet-header', connectWith: '.column' }); $(.column).disableSelection(); }); /script /head body div class=demo div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div psddfds/p /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div /div /body /html On Oct 2, 3:09 pm, Nalum mallon.l...@gmail.com wrote: Is the code in the original post all the code you have? On Oct 2, 3:03 pm, craigeves craige...@googlemail.com wrote: Thanks for this -
[jQuery] Re: Block access to the page but unblock certains divs
I think you'll have to do it in such a way that it blocks the different elements individually and then unblock the ones that have errors. e.g. $('.blockMe').blockUI({message: null}); $('.error').unblock(); On Oct 2, 3:51 pm, samh12 ste...@bluemania.co.uk wrote: Hi Nalum, Idon't think that answers my question. I know I can block at page and element level however I want a mixture. I want to block the page but leave the element that's in error alone i.e. $(document).ready(function() { $('#btnSubmit').click(function() { $.blockUI({ message: null }); $('#form_surname').unblock(); //now unblock the surname field as this needs correcting $('.blockOverlay').attr('title','Click to unblock').click($.unblockUI); }); }); Thanks.
[jQuery] Re: jQuery UI Portlets Cookies
Thanks so much for this - i'll compare the script that you just submitted to the one i submitted to see where i went wrong. Thanks again Craig On Oct 2, 4:21 pm, Nalum mallon.l...@gmail.com wrote: I've updated the javascript here.http://pastebin.com/m4caef476 If you need any help in understanding whats happening here let me know and I'll try to explain it, I'm not the best at explaining things though. Nalum On Oct 2, 4:06 pm, craigeves craige...@googlemail.com wrote: Hi Nalum I have tried and amended the code as you suggested - but still no luck? Thanks for the tip (pastebin). Here is my full code now. Please would you take a quick look and let me know where im going wrong? http://pastebin.com/m4dab8bb2 Thanks for your help in this - it's really appreciated! Craig On Oct 2, 3:40 pm, Nalum mallon.l...@gmail.com wrote: Hello Craig, When you need to show code you should try using a site likehttp://pastebin.com as it'll make it easier to read and your post wont be so long. You'll need to be able to work with cookies, I would suggest this jquery pluginhttp://plugins.jquery.com/project/cookie. I've explained how it works in this code herehttp://pastebin.com/m2c0e0bde. Hope this helps you out. Nalum On Oct 2, 3:15 pm, craigeves craige...@googlemail.com wrote: Here it is - thanks for your help again !doctype html html lang=en head titlejQuery UI Sortable - Portlets/title script type=text/javascript src=jquery-1.3.2.js/script script type=text/javascript src=ui.core.js/script script type=text/javascript src=ui.sortable.js/script style type=text/css .column { width: 300px; float: left; background-color: #ee; margin-right: 25px; padding-top: 10px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; height: 700px;} .portlet { background-color: #FFF; margin-top: 0; margin-right: 0; margin-bottom: 10; margin-left: 0;} .portlet-header { margin: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; background-color: #333; padding: 10px; color: #FFF;} .portlet-header .ui-icon { float: right; } .portlet-content { padding: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; color: #333; margin-bottom: 10px;} .ui-sortable-placeholder { border: 1px dotted black; visibility: visible} .ui-sortable-placeholder * { visibility: hidden; } /style script type=text/javascript $(function() { $(.column).sortable({ handle: '.portlet-header', connectWith: '.column' }); $(.column).disableSelection(); }); /script /head body div class=demo div class=column div class=portlet div class=portlet-header ui-state-disabledFeeds/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerNews/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div /div div class=column div class=portlet div class=portlet-headerShopping/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div psddfds/p /div div class=column div class=portlet div class=portlet-headerLinks/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit./div /div div class=portlet div class=portlet-headerImages/div div class=portlet-contentLorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing
[jQuery] Problem with URL formatting with $.ajax
Here is my code: $.ajax({ url: lUrl, global: true, async: false, data:{none:none}, type: GET, dataType: text, success: function(result){ alert(result is +result); parsedJSON = JSON.parse(data); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); All of my urls that are sent to the server have ?_=(some random number). In the specific case of the above code, the generated URL is http://url/script.php?_=1254497109001none=none;. How can I prevent this from happening? Why is it happening?
[jQuery] Re: jQuery UI Portlets Cookies
On Fri, Oct 2, 2009 at 11:06 AM, craigeves craige...@googlemail.com wrote: Thanks for the tip (pastebin). Another really great site for sharing code is jsbin.com http://jsbin.com/ It's got a drop-down for including jQuery and jQuery UI, live preview of full page code samples, and an editor so someone can edit a link you send, test it, and send a new link back. - Richard
[jQuery] Re: Problem with submit button of an inserted form
2009/10/2 Giovanni Battista Lenoci gian...@gmail.com: I have the following code: $(placeInDOM).replaceWith(header + fields + footer); $(placeInDOM).find(':submit').click(function() { alert(clicked the submit button); return false; }); The first statement places a form with a submit button in my page. This works as it should. With the second I want to give an alert instead of a submit when clicking on the submit button. But it does not work. When I after the first statement execute: alert($(placeInDOM).find(':submit').html()); I get null This is right, cause a subimit button doesn't have html in it... If I execute: alert($(placeInDOM).find(':submit')); I get: [object Object] What am I doing wrong? Try using console.log of firebug to see if the returned object contains what you're expecting. That is a good tip. I'll use that next time. I solved my problem. I know use: $(placeInDOM).replaceWith(header + fields + footer); $('.submit_' + formID).click(function() { form = $('#' + formID); form.fadeOut('normal'); jQuery.post(cgiURL, form.serialize(), function(xml) { alert($(xml).find('status').text()); form.fadeIn('normal'); }, xml ); return false; }); This does what it should do. The only 'problem' is that the whole DOM is traversed instead of only placeInDOM. If someone knows how to optimize this ... Is there a way to let the fadeOut be finished before continuing? A question, what placeInDOM contains? is an id? the html you're replacing contains the id? div#contact_form What is inserted starts with: form id = contact_form action = /cgi-bin/contact3.cgi method = post input name = command type = hidden value = sendForm / input name = formtype = hidden value = contact / table tr tdOrganisatie/td tdinput name = organisation //td /tr tr tdSoort Organisatie/td td select name = organisationType option value = 00geen/option option value = 01Non Profit/option option value = 02ZZP/option option value = 03MKB/option option value = 04Anders/option /select /td and ends with: tr tdOmschrijving/td tdtextarea name = description/textarea/td /tr tr tdnbsp;/td td input type = submit value = Versturen class = submit_contact_form / input type = Reset value = Wissen / /td /tr /table /form -- Cecil Westerhof
[jQuery] Re: Problem with URL formatting with $.ajax
I believe it was because I originally had global: false. Once I changed that, the URL formatted as I expected it to. On Oct 2, 11:31 am, acedanger acedange...@gmail.com wrote: Here is my code: $.ajax({ url: lUrl, global: true, async: false, data:{none:none}, type: GET, dataType: text, success: function(result){ alert(result is +result); parsedJSON = JSON.parse(data); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); All of my urls that are sent to the server have ?_=(some random number). In the specific case of the above code, the generated URL is http://url/script.php?_=1254497109001none=none;. How can I prevent this from happening? Why is it happening?
[jQuery] Pick different effects with jquery
Hello everyone, Currently i'm working on a website which needs an auto play photo gallery. The admins of the website are allowed to upload 10 or more images, which will be displayed in the gallery. I am able to show those images one by one, with 1 effect (for example fade-in from left), but what i need is different effects which will be called random. So image 1 will be fade in from the right, and image 2 will be fade in with a zoom effect and so on. How can i realize this? Kind regards, Thavipa
[jQuery] Re: Problem with submit button of an inserted form
first the easy thing: Is there a way to let the fadeOut be finished before continuing? Yes, fadeOut accept a callback function that is called after the effect end, take a look here: http://docs.jquery.com/Effects/fadeOut#speedcallback A question, what placeInDOM contains? is an id? the html you're replacing contains the id? div#contact_form it is a string? the markup you've pasted shows a form that has an id contact_form, not a div, maybe the problem is here? I solved my problem. I know use: $(placeInDOM).replaceWith(header + fields + footer); $('.submit_' + formID).click(function() { form = $('#' + formID); form.fadeOut('normal'); jQuery.post(cgiURL, form.serialize(), function(xml) { alert($(xml).find('status').text()); form.fadeIn('normal'); }, xml ); return false; }); This does what it should do. The only 'problem' is that the whole DOM is traversed instead of only placeInDOM. If someone knows how to optimize this ... if you solve your first problem you don't need to do this, only for aknowledgment you can use your selector also in this way: $form = $('#' + formID); $('.submit_' + formID, $form).click(function() { $form is the context in which jquery looks for the element with class '.submit_' + formID, but if I haven't misunderstood, if you change placeInDOM from div#contact_form to #contact_form you solve your problem and you can use the first version of the code you've posted before. Bye -- gianiaz.net - web solutions via piedo, 58 - 23020 tresivio (so) - italy +39 347 7196482
[jQuery] Re: jQuery Navigation problems
alright I figured it out, by putting my removeClass after my addClasses it works great function nav_label() { $(.nav_label).children(ul).addClass(lev1).children (li).addClass(lev1).children(a).addClass(lev1).parent ().children(ul).addClass(lev2).children(li).addClass (lev2).children(a).addClass(lev2); $(.nav_label).children(ul).removeClass(hideNav); On Oct 2, 10:19 am, Zach Schneider zachschnei...@gmail.com wrote: well I hide the DIV with CSS visibility: hidden; and with jQuery I want to change the stylesheet and remove the visibility to visible, the problem I am having I am not that familiar with jQuery to know how to do that On Oct 1, 10:41 pm, Scooby scoob...@gmail.com wrote: How are you hiding your UL's? From my experience, hiding them with css is faster than jQuery.. I just hide them using both.. Seems to work fine for me.. On Oct 1, 8:41 pm, ZKM zachschnei...@gmail.com wrote: I have a website that has very large UL navigation created with jQuery and every time you goto the page it flashes the entire UL for a split of a second. So what I want to do is find a way to make it to do I think is hide the UL until the CSS and jQuery is loaded than display the menu. If anyone has a better idea I am all ears and I am also new to jQuery but catching on fast.
[jQuery] Re: keeping table header fix
Hmm, I gave this a try. Setting height stretches the table rows out vertically if there are less records than the height. I tried putting a fixed height div around the table and not setting a height on the tbody, but then the tbody overflow-y never kicks in. Hmm. Also, if I set the height of the tbody and the overflow-y does kick in, then the scrollbar eats horizontal space in the rightmost col, which means that I need to style that col to allow for it. Either way: if the scrollbar were to show outside the table I'd need to allow room for it, but just bringing it up as a caveat. I know this issue has been tackled various ways in table plugins, but I don't think I've seen a plugin made specifically just for show/hiding a scrollbar and working around some of these issues. Anyone? Thanks, Jack Matt Zagrabelny wrote: On Thu, 2009-10-01 at 22:25 -0400, Karl Swedberg wrote: have you tried overflow-y: auto; ? This works... (to some degree) table tbody { height: 799px; overflow-y: auto; overflow-x: hidden; } Cheers,
[jQuery] why plugin function need 2 parameter sometimes
I don't see how maxentries as parameter is need in this code jQuery.fn.pagination = function(maxentries, opts) in some plugins, i see everything works fine with just something like this jQuery.fn.pluginname = function(opts)
[jQuery] Re: Show/hide effect div on mouseover
Normally the hover function will cause the menu div to disappear in this scenario, as the mouse moves over the child elements. But if you use the hoverIntent plugin, it'll do the trick for you. Liam Mface wrote: Hi, I have a CSS menu that I created using div that current appears using the hover function in the CSS. What I would like to do is incorporate javascript to utilise the effect of fading in when the mouse moves over the 'menu' text and then with a delay fades out when the mouse moves out of the menu area. Is this possible? Please advise... Thanks No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.14.3/2409 - Release Date: 10/02/09 06:46:00
[jQuery] Re: Problem with submit button of an inserted form
2009/10/2 Giovanni Battista Lenoci gian...@gmail.com: first the easy thing: Is there a way to let the fadeOut be finished before continuing? Yes, fadeOut accept a callback function that is called after the effect end, take a look here: http://docs.jquery.com/Effects/fadeOut#speedcallback That I allready found. I tried the folowing: $(placeInDOM).replaceWith(header + fields + footer); $('.submit_' + formID).click(function() { var fadeOutReady = false; var fadeSpeed= 1500; var form = $('#' + formID); form.fadeOut(fadeSpeed, function() { fadeOutReady = true; }); while( !fadeOutReady ) { // wait untill fadeOut is ready } jQuery.post(cgiURL, form.serialize(), function(xml) { alert($(xml).find('status').text() + '\n' + $(xml).find('duration').text()); form.fadeIn(fadeSpeed); }, xml ); return false; }); But when I use this code, my processor is very busy and the fadeOut does not happen. A question, what placeInDOM contains? is an id? the html you're replacing contains the id? div#contact_form it is a string? the markup you've pasted shows a form that has an id contact_form, not a div, maybe the problem is here? My html contains: div id = contact_form div align = centerfont color = #FF Hier zou een contact formulier moeten staan!!! /font/div So the div is replaced by a form. And this works without a problem. And there is also my stupid mistake. The div is replaced, so I should not search for it anymore. That happens when you want to make something 'fast'. I know use: $(placeInDOM).replaceWith(header + fields + footer); $thisForm = $('#' + formID); $(':submit', $thisForm).click(function() { I do not need a class anymore. I want to change the click event for all the submit buttons of the form and no other submit buttons. The above code does this. if you solve your first problem you don't need to do this, only for aknowledgment you can use your selector also in this way: $form = $('#' + formID); $('.submit_' + formID, $form).click(function() { $form is the context in which jquery looks for the element with class '.submit_' + formID, but if I haven't misunderstood, if you change placeInDOM from div#contact_form to #contact_form you solve your problem and you can use the first version of the code you've posted before. I prefer the way I do it know. In this way the HTML-page or the function can change the way the id's are made, without breaking anything. In the above way the HTML and function has to be synchronized. I prefer to minimize the possibilities to break things. Thanks for the help. -- Cecil Westerhof
[jQuery] how to get at jquery elements when i'm looping through a jquery select list with 'each'
Hi. I’m doing something dumb with jquery, but I can’t put my finger on what is causing my problem. I’m trying to debug some jquery code and I wanted to list the html of each element that I’m picking up from my select list. I have a shrunken down sample of what I’m doing below.. the first alert shows something that looks like a java object, the second alert bombs and the loop exits. Can any of you offer any tips or guidance ? Thanks very much in advance ! Chris !DOCTYPE html html head link type=text/css href=http://jqueryui.com/latest/themes/base/ui.all.css; rel=stylesheet / script type=text/javascript src=http://jqueryui.com/latest/jquery-1.3.2.js;/script script type=text/javascript src=http://jqueryui.com/latest/ui/ui.core.js;/script script type=text/javascript src=http://jqueryui.com/latest/ui/ui.draggable.js;/script script type=text/javascript src=http://jqueryui.com/latest/ui/ui.resizable.js;/script script type=text/javascript src=http://jqueryui.com/latest/ui/ui.dialog.js;/script script type=text/javascript $(document).ready(function(){ alert('hello box'); $(div.disabled label).each ( function() { alert(got a label + this); alert(got a label + this.html()); // THIS FAILS. }); }); /script /head body class=yui-skin-sam style=height: 100%;^M div id=spinner class=spinner style=display: none;^M page_files/spinner.gif ^M /div^M ^M ^M ^M ^M div id=body^M div class=column five disabled^M label style=color: orange; for=utility-statusUtility Status/label^M select style=color: orange; name=utilityStatus.id id=utility-status^M option value=/option^M option value=6862foo/option^M option value=6863 selected=selectedbar/option^M option value=6864big/option^M option value=6865small/option^M option value=6902Closed/option^M option value=3756Cancelled/option^M option value=6859On Hold/option^M /select^M /div^M /div^M ^M div id=ui-datepicker-div class=ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible /div/body/html -- View this message in context: http://www.nabble.com/how-to-get-at--jquery-elements-when-i%27m-looping-through-a-jquery-select-list-with-%27each%27-tp25716736s27240p25716736.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Problem with submit button of an inserted form
Cecil Westerhof ha scritto: 2009/10/2 Giovanni Battista Lenoci gian...@gmail.com: first the easy thing: Is there a way to let the fadeOut be finished before continuing? Yes, fadeOut accept a callback function that is called after the effect end, take a look here: http://docs.jquery.com/Effects/fadeOut#speedcallback That I allready found. I tried the folowing: $(placeInDOM).replaceWith(header + fields + footer); $('.submit_' + formID).click(function() { var fadeOutReady = false; var fadeSpeed= 1500; var form = $('#' + formID); form.fadeOut(fadeSpeed, function() { fadeOutReady = true; }); while( !fadeOutReady ) { // wait untill fadeOut is ready } jQuery.post(cgiURL, form.serialize(), function(xml) { alert($(xml).find('status').text() + '\n' + $(xml).find('duration').text()); form.fadeIn(fadeSpeed); }, xml ); return false; }); But when I use this code, my processor is very busy and the fadeOut does not happen. Yes, because fadeOut is asinc, then after calling it you stop the javascript execution with the while, and the fadeOutReady will be always false, you have to do this (not tested, but should work): form.fadeOut(fadeSpeed, function() { jQuery.post(cgiURL, form.serialize(), function(xml) { alert($(xml).find('status').text() + '\n' + $(xml).find('duration').text()); form.fadeIn(fadeSpeed); }, xml ); }); I know use: $(placeInDOM).replaceWith(header + fields + footer); $thisForm = $('#' + formID); $(':submit', $thisForm).click(function() { I do not need a class anymore. I want to change the click event for all the submit buttons of the form and no other submit buttons. The above code does this. I prefer the way I do it know. In this way the HTML-page or the function can change the way the id's are made, without breaking anything. In the above way the HTML and function has to be synchronized. I prefer to minimize the possibilities to break things. You're right, the :submit selector is better... i did a fast copy and paste :-) p.s. I now use, not I know use... and please if you find any error on my posts please correct me, I have to learn a lot about english (and jquery too) :-) Bye -- gianiaz.net - web solutions via piedo, 58 - 23020 tresivio (so) - italy +39 347 7196482
[jQuery] Re: how to get at jquery elements when i'm looping through a jquery select list with 'each'
A colleague helped me with a solution: This does what I want -alert(got a label + $(this).parent().html()); seems you have to wrap the raw java script element before calling jquery functions on it. makes sense. buildlackey wrote: Hi. I’m doing something dumb with jquery, but I can’t put my finger on what is causing my problem. I’m trying to debug some jquery code and I wanted to list the html of each element that I’m picking up from my select list. I have a shrunken down sample of what I’m doing below.. the first alert shows something that looks like a java object, the second alert bombs and the loop exits. Can any of you offer any tips or guidance ? Thanks very much in advance ! Chris !DOCTYPE html html head link type=text/css href=http://jqueryui.com/latest/themes/base/ui.all.css; rel=stylesheet / script type=text/javascript src=http://jqueryui.com/latest/jquery-1.3.2.js;/script script type=text/javascript src=http://jqueryui.com/latest/ui/ui.core.js;/script script type=text/javascript src=http://jqueryui.com/latest/ui/ui.draggable.js;/script script type=text/javascript src=http://jqueryui.com/latest/ui/ui.resizable.js;/script script type=text/javascript src=http://jqueryui.com/latest/ui/ui.dialog.js;/script script type=text/javascript $(document).ready(function(){ alert('hello box'); $(div.disabled label).each ( function() { alert(got a label + this); alert(got a label + this.html()); // THIS FAILS. }); }); /script /head body class=yui-skin-sam style=height: 100%;^M div id=spinner class=spinner style=display: none;^M page_files/spinner.gif ^M /div^M ^M ^M ^M ^M div id=body^M div class=column five disabled^M label style=color: orange; for=utility-statusUtility Status/label^M select style=color: orange; name=utilityStatus.id id=utility-status^M option value=/option^M option value=6862foo/option^M option value=6863 selected=selectedbar/option^M option value=6864big/option^M option value=6865small/option^M option value=6902Closed/option^M option value=3756Cancelled/option^M option value=6859On Hold/option^M /select^M /div^M /div^M ^M div id=ui-datepicker-div class=ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible /div/body/html -- View this message in context: http://www.nabble.com/how-to-get-at--jquery-elements-when-i%27m-looping-through-a-jquery-select-list-with-%27each%27-tp25716736s27240p25716744.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: how to get at jquery elements when i'm looping through a jquery select list with 'each'
buildlackey ha scritto: $(div.disabled label).each ( function() { alert(got a label + this); alert(got a label + this.html()); // THIS FAILS. }); Inside each this rappresents the html object and not a jquery or javascript (not java! :-)) object. If you want to use jquery methods inside the function you have to use this code: $(div.disabled label).each(function() { alert(got a label (html object): + this); alert(got a label + $(this).html()); // THIS FAILS. }); $(this) returns the jquery object of the html object this. If you want to better explore your object use the console.log method (you have to install firebug for firefox or companion.js for the internet explorer debug bar). bye -- gianiaz.net - web solutions via piedo, 58 - 23020 tresivio (so) - italy +39 347 7196482
[jQuery] Re: Pick different effects with jquery
Thavipa ha scritto: Hello everyone, Currently i'm working on a website which needs an auto play photo gallery. The admins of the website are allowed to upload 10 or more images, which will be displayed in the gallery. I am able to show those images one by one, with 1 effect (for example fade-in from left), but what i need is different effects which will be called random. So image 1 will be fade in from the right, and image 2 will be fade in with a zoom effect and so on. How can i realize this? Try taking a look at the wonderful cycle plugin of Mike Alsup: http://malsup.com/jquery/cycle/options.html Bye -- gianiaz.net - web solutions via piedo, 58 - 23020 tresivio (so) - italy +39 347 7196482
[jQuery] Re: Problem with submit button of an inserted form
2009/10/2 Giovanni Battista Lenoci gian...@gmail.com: Yes, fadeOut accept a callback function that is called after the effect end, take a look here: http://docs.jquery.com/Effects/fadeOut#speedcallback That I allready found. I tried the folowing: $(placeInDOM).replaceWith(header + fields + footer); $('.submit_' + formID).click(function() { var fadeOutReady = false; var fadeSpeed = 1500; var form = $('#' + formID); form.fadeOut(fadeSpeed, function() { fadeOutReady = true; }); while( !fadeOutReady ) { // wait untill fadeOut is ready } jQuery.post(cgiURL, form.serialize(), function(xml) { alert($(xml).find('status').text() + '\n' + $(xml).find('duration').text()); form.fadeIn(fadeSpeed); }, xml ); return false; }); But when I use this code, my processor is very busy and the fadeOut does not happen. Yes, because fadeOut is asinc, then after calling it you stop the javascript execution with the while, and the fadeOutReady will be always false, you have to do this (not tested, but should work): form.fadeOut(fadeSpeed, function() { jQuery.post(cgiURL, form.serialize(), function(xml) { alert($(xml).find('status').text() + '\n' + $(xml).find('duration').text()); form.fadeIn(fadeSpeed); }, xml ); }); I should have thought about it myself. :-[ It work likes a charm. Thanks. You're right, the :submit selector is better... i did a fast copy and paste :-) That is more as good enough. When you put me on the right track, I can clean up the code myself. :-] I now use, not I know use... I was to fast again. I am just to impatient. I like to get things done. and please if you find any error on my posts please correct me, I have to learn a lot about english (and jquery too) :-) Is a deal. :-D -- Cecil Westerhof
[jQuery] LI.offset and LI.position() gives erratic results
I am getting erratic results when trying to get the position of a LI element. Every browser gives different results - only IE7 seems to get it right... I have a navbar UL element nested a few levels deep within DIVs that provide page structure. The UL is also nested within a SPAN (inline- block) so the UL element can be centered within DIV#Nav1. A stripped- down version of the HTML is shown at bottom. The LI elements trigger a custom drop-down menu onHover. I use simple math to calculate the positioning of the DIV that acts as a menu... var $LI = $(this) // LI element , tabOffset = $LI.offset() , menuTop = tabOffset.top + $LI.outerHeight() , menuLeft = Math.floor(tabOffset.left) ; In IE7, this works perfectly - exactly as you would expect. But every other browser has one or more issues... Internet Explorer 7 $LI.offset().left = CORRECT $LI.offset().top = CORRECT $LI.position().top = 0 - CORRECT Chrome 3.0.195.21 $LI.offset().left = the Left-edge of the parent UL element! $LI.offset().top = CORRECT $LI.position().top = 0 - CORRECT FireFox 3.5 $LI.offset().left = the Right-edge of the parent UL element $LI.offset().top = too small by 15px $LI.position().top = -15 -- wrong, the LI has NO top-margin Opera 9.64 $LI.offset().left = the Right-edge of the parent UL element $LI.offset().top = CORRECT $LI.position().top = -19, even though offset().top is correct Only IE gets $LI.offset().left correct. Only IE and Chrome get $LI.position().top right (0), but IE, Chrome and Opera all get $LI.offset().top correct, even though Opera gets $LI.position().top wrong (-19). Only FireFox gets everything wrong! Can anyone shed any light on these discrepancies? I will spend the time to create and post a test page if no one can offer any clues, but I have not done so yet. Thanks in advance. /Kevin !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; DIV id=Layout-Header DIV class=layout-header DIV id=TopNavbar class=navbar DIV id=Nav1 SPAN class=center UL class=tabs LIA href=/rentalsRentals/A/LI LIA href=/linensLinens/A/LI LIA href=/servicesServices/A/LI LIA href=/plannerPlanner/A/LI LIA href=/galleryGallery/A/LI LIA href=/communityCommunity/A/LI LIA href=/aboutAbout Us/A/LI /UL /SPAN /DIV /DIV /DIV /DIV
[jQuery] ajax submit upload file firebug... no answer
Hi, I've a technical problem, i use jQuery Form Plugin and it's working well except for upload file. Effectively after uploading file we can't see any response in firebug. (You can see an example in the official website of jquery form plugin http://malsup.com/jquery/form/#code-samples) And in the response i call a script with script src=script.js type=text/javascript/script My page get this file well but i have a javascript error on the $ of $(document).ready(function() {... I think it's because why don't have the first answer... Do you have a idea? Thanx Harold
[jQuery] Switch image source during toggle
I have some divs I am toggling and there is a little + sign image I want to change to a - sign image when the toggle event occurs, but can't quite figure it out. Here is the toggle code I have (taken from a helpful post on here): $j(document).ready(function() { $j('#answerbox').hide(); $j('a.faq').click(function() { var faq_id = $j(this).attr('id'); $j('#faq' + faq_id).slideToggle(fast); return false; }); }); The image is not contained within the a tag, so I guess I need a separate function to callback.
[jQuery] Validation: Form with multiple submit buttons having different validation rules
Hi all, I tried searching for similar issues but couldn't find a satisfying answer. So posting it here. I have a form with multiple fieldsets which are visible conditionally. There are three submit buttons Abandon, Save and Save Continue. Each button should validate specific controls of the form and submit it. I tried setting onsubmit: false and checking for $('#myForm').valid () on click of these buttons., but that validates all controls of the form. Can someone suggest me what I should do?
[jQuery] Re: autocomplete click send focus back to input
I figured it out $(#myinput).autocomplete(_url,{ onItemSelect: function(){ $('#myinput').focus(); } }); although i couldnt find onItemSelect anywhere in the documentation On Oct 1, 8:46 pm, travisjbeck smoothopera...@gmail.com wrote: are there any callbacks for me to hook into in order to send the focus (); back to my input box when someone selects or clicks and autocomplete item?
[jQuery] Re: load() confusion
What exactly are you trying to do? If you're trying to load HTML into a div, you can kind of imitate it with a setInterval function that periodically checks whether the content has changed or not. If the div is not empty, first you check the content and store it (or a checksum of it) somewhere. Then run a setInterval to check whether the content (or its checksum) has changed every so often. If so, run a callback function. (This wouldn't work on checking whether an image is loaded, only HTML content. You'd have to directly check the img fire the load callback for that.) You can bundle this all into a custom jQuery event. Who knows, there's probably a plug-in or something out there for it already... On Oct 1, 5:30 pm, Michael Rowe flyagari...@gmail.com wrote: Ok, so is there a way with javascript to fire a function when a div is finished loading it's contents? On Thu, Oct 1, 2009 at 8:38 PM, MorningZ morni...@gmail.com wrote: James: there is also a JavaScript event called load for certain DOM objects.. and consequently the ability to wire jQuery onto that (http://docs.jquery.com/Events/load#fn) to original poster: if I target the IMG, then it works fine, but how come it doesn't work with the div? because div's don't fire a load event, and as you found out, images do On Oct 1, 5:31 pm, James james.gp@gmail.com wrote: load() is suppose to take a url as the first parameter. http://docs.jquery.com/Ajax/load On Oct 1, 8:47 am, flyagaricus flyagari...@gmail.com wrote: I'm new to JQuery I can't get load() to work with a div class: script type='text/javascript' jQuery(document).ready(function($) { $(.Loader).load(function(){ alert(bang); }); }); /script div class=Loader img src=http://home.arcor.de/poesenau/Witness-Tree.JPG; width=1200 height=1600 / /div if I target the IMG, then it works fine, but how come it doesn't work with the div?
[jQuery] Re: Ajax / Form Validation
Try putting: var validation_options = {...}; outside of $(document).ready(); On Oct 1, 5:13 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: This is my script now. script type=text/javascript $(document).ready(function() { $('#testForm').bind('submit', function() { $(this).validate(validation_options); var valid = $(this).valid(); if (valid) { var queryString = $('#testForm').formSerialize(); //alert(queryString); $(this).ajaxSubmit({ type: 'post', url: '/manage/experiences/edit/123', data: queryString, target: '#testUpdate', success: afterEffects }); return false; } }); function afterEffects () { $.fn.colorbox.close(); } var validation_options = { // set your options here rules: { field: required } }; }); /script When I hit submit it tries to access the url by the browser. Check the net activity and see _method PUT data[Experience][city] LosAngeles data[Experience][country_id] 38 data[Experience][finished] 2007 data[Experience][position] Customer Service Rep data[Experience][respons] sweet sf data[Experience][start] 1975 data[Experience][state_id] 15 field Nothing is working. Ideas? Dave -Original Message- From: James [mailto:james.gp@gmail.com] Sent: October-02-09 12:19 AM To: jQuery (English) Subject: [jQuery] Re: Ajax / Form Validation Here's a simplified version of what you want to do: $('#testForm').bind('submit', function() { $(this).validate(validation_options); var valid = $(this).valid(); if (valid) { // do your ajax } }); var validation_options = { // set your options here }; On Oct 1, 10:52 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have a form that gets submitted via AJAX, now i want to add the validation but cant make sense of it. Using malsup form script to submit, Now I would like to incorporate the jQuery Validation Plug-in found onhttp://jquery.bassistance.de/validate/demo/index.html I currently have this so submit: script type=text/javascript $(document).ready(function() { $('#testForm').live(click, function(){ $('#testForm').bind('submit', function() { var queryString = $('#testForm').formSerialize(); var id = '?php echo $id; ?'; $(this).ajaxSubmit({ type: 'post', url: '/manage/experiences/edit/123', data: queryString, target: '#updateMe', success: afterEffects }); return false; }); }); function afterEffects () { $.fn.colorbox.close(); } }) /script But how do I add in the validation script into this? Any help would be greatly appreciated. Thanks Dave
[jQuery] Re: Switch image source during toggle
Could you post your relevant HTML also with some kind of sample image src and what you would like it to look like after it's been toggled? On Oct 2, 6:26 am, Gremlyn1 greml...@gmail.com wrote: I have some divs I am toggling and there is a little + sign image I want to change to a - sign image when the toggle event occurs, but can't quite figure it out. Here is the toggle code I have (taken from a helpful post on here): $j(document).ready(function() { $j('#answerbox').hide(); $j('a.faq').click(function() { var faq_id = $j(this).attr('id'); $j('#faq' + faq_id).slideToggle(fast); return false; }); }); The image is not contained within the a tag, so I guess I need a separate function to callback.
[jQuery] Re: ajax submit upload file firebug... no answer
Could you post some relevant code on how you're doing all of this? It's hard to help from only reading what you've described. On Oct 2, 5:48 am, Harold Martin hmartin...@gmail.com wrote: Hi, I've a technical problem, i use jQuery Form Plugin and it's working well except for upload file. Effectively after uploading file we can't see any response in firebug. (You can see an example in the official website of jquery form pluginhttp://malsup.com/jquery/form/#code-samples) And in the response i call a script with script src=script.js type=text/javascript/script My page get this file well but i have a javascript error on the $ of $(document).ready(function() {... I think it's because why don't have the first answer... Do you have a idea? Thanx Harold
[jQuery] Re: Problem with URL formatting with $.ajax
Also note that setting the cache:false option will create that additional parameter with a random value. That way the browser will not find a cache with the same resource name and always requests a new page. On Oct 2, 5:42 am, acedanger acedange...@gmail.com wrote: I believe it was because I originally had global: false. Once I changed that, the URL formatted as I expected it to. On Oct 2, 11:31 am, acedanger acedange...@gmail.com wrote: Here is my code: $.ajax({ url: lUrl, global: true, async: false, data:{none:none}, type: GET, dataType: text, success: function(result){ alert(result is +result); parsedJSON = JSON.parse(data); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); All of my urls that are sent to the server have ?_=(some random number). In the specific case of the above code, the generated URL is http://url/script.php?_=1254497109001none=none;. How can I prevent this from happening? Why is it happening?
[jQuery] Re: How to disable text inputs lying near checkboxes ?
Here the way to enable/disable several text inputs depending on the state of checkboxes located just after each one. $(':text~:checkbox').change( function(){ $(this).prev()[0].disabled = !(this.checked); } ); Hope this can help others.
[jQuery] Validation help needed
when i run this.submit(); i submit my ajax request, so how can i get the validate to fire on invalidHandler and submitHandler so I will only run this.submit(); when it passes validation ? Currently the validator does not validate the form at all on submit, I need it to cancel the submit if there are validation issues and submit if there are none. function submitForm(form) { this.submit(); $(#frmAddTask).validate({ errorPlacement: function(error, element) { error.insertAfter (element); }, invalidHandler: function(form, validator) { alert(validation failed); }, submitHandler: function(form, validator) { alert(validation passed); }, rules: { title: { required: true, minlength: 5 } } }); } // Build Add a New Task pop up dialog // Instantiate the Add a New Task pop up dialog YAHOO.util.Dom.removeClass('dlgAddTask', 'hideForm'); YAHOO.techdocs.dlgAddTask = new YAHOO.widget.Dialog(dlgAddTask, { width : 50em, height: 32em, fixedcenter : true, visible : false, constraintoviewport : true, close: false, buttons : [ { text:Submit, handler:submitForm, isDefault:true }, { text:Cancel, handler:function() {this.cancel();} } ] });
[jQuery] Re: Validation help needed
You should not be calling submit() first. You only call it after everything is validated. This can be as easy as a if-statement. Here's a simple example. Modify it to work with your scenrio. $(function() { $('#testForm').bind('submit', function() { $(this).validate(validation_options); var valid = $(this).valid(); if (valid) { // do your ajax } }); }); var validation_options = { // set your options here }; On Oct 2, 9:13 am, coachz bringmewa...@gmail.com wrote: when i run this.submit(); i submit my ajax request, so how can i get the validate to fire on invalidHandler and submitHandler so I will only run this.submit(); when it passes validation ? Currently the validator does not validate the form at all on submit, I need it to cancel the submit if there are validation issues and submit if there are none. function submitForm(form) { this.submit(); $(#frmAddTask).validate({ errorPlacement: function(error, element) { error.insertAfter (element); }, invalidHandler: function(form, validator) { alert(validation failed); }, submitHandler: function(form, validator) { alert(validation passed); }, rules: { title: { required: true, minlength: 5 } } }); } // Build Add a New Task pop up dialog // Instantiate the Add a New Task pop up dialog YAHOO.util.Dom.removeClass('dlgAddTask', 'hideForm'); YAHOO.techdocs.dlgAddTask = new YAHOO.widget.Dialog(dlgAddTask, { width : 50em, height: 32em, fixedcenter : true, visible : false, constraintoviewport : true, close: false, buttons : [ { text:Submit, handler:submitForm, isDefault:true }, { text:Cancel, handler:function() {this.cancel();} } ] });
[jQuery] Re: keeping table header fix
On Oct 2, 2009, at 12:11 PM, Jack Killpatrick wrote: Hmm, I gave this a try. Setting height stretches the table rows out vertically if there are less records than the height. I tried putting a fixed height div around the table and not setting a height on the tbody, but then the tbody overflow-y never kicks in. Hmm. you could use max-height: 799px; instead of height: 799px; Also, if I set the height of the tbody and the overflow-y does kick in, then the scrollbar eats horizontal space in the rightmost col, which means that I need to style that col to allow for it. Either way: if the scrollbar were to show outside the table I'd need to allow room for it, but just bringing it up as a caveat. try overflow-y: scroll; rather than overflow-y: auto; you'll get the scrollbar area whether it's needed or not, but at least it will be consistent. --Karl
[jQuery] Re: How to disable text inputs lying near checkboxes ?
On Oct 2, 2009, at 3:02 PM, Julien wrote: Here the way to enable/disable several text inputs depending on the state of checkboxes located just after each one. $(':text~:checkbox').change( function(){ $(this).prev()[0].disabled = !(this.checked); } ); Hope this can help others. ah, that's quite elegant. nice work! --Karl
[jQuery] Re: something missing from my code?
si it would be $('#project1').hide(); $('#project2').show() instead of doing it via css? On Oct 2, 9:15 am, MorningZ morni...@gmail.com wrote: also instead of $('#project1').css('display','none'); $('#project2').css('display',''); it's better habit to use .hide() and .show(), which gives you more options (like animation effects if you want) as well as automatically handles different show/hide code needed for different types of DOM objects On Oct 2, 9:00 am, Glen_H glen.f.he...@gmail.com wrote: Hey guys, Im new to Javascript and JQuery, I am trying to have a featured area on the front page to my site, basically there is a right div area which holds the picture, on the left there is a menu with 4 buttons. here is the html: div id=projectmenu ul id=projMenu lia class=projOne title=Project1/a/li lia class=projTwo title=Project2/a/li lia class=projThree title=Project3/a/li lia class=projFour title=Project4/a/li /ul /div div class=project id=project1/div div class=project id=project2/div div class=project id=project3/div div class=project id=project4/div /div Here is the way im setting up the JQuery to try and make the active div change when I choose a button: $(function() { $('a projTwo').click(function() { $('#project1').css('display','none'); $('#project2').css ('display',''); }); }); does anyone see where I am going wrong? when I get into the CSS portion will it have to go all the way back like how css is written? meaning in order to identify it, would it have to be #container #project1 or will just #project1 work? thank you in advance
[jQuery] tooltip - how do i remove an existing tooltip
Hi, I am using tooltip in my application as a way to notify the user as to what kind of error was found in thier input field. My question is, once that error is resolved and validated correctly, is there a way i can remove the tooltip?
[jQuery] Re: iframe accesing main document functions?
Hi ximo, You want to call a function in the parent window? Are the main window and the iframe loaded from the same domain? If so, did you try calling window.parent.yourFunc(); from within your iframe? If the main window is not on the same domain as the iframe - try using the pmrpc library (http://code.google.com/p/pmrpc/). Pmrpc is a HTML5 inter-window cross-domain JSON-RPC based remote procedure call JavaScript library. The library provides a simple API for exposing and calling procedures from windows or iFrames on different domains, without being subject to the same-origin policy. You can use pmrpc even if the iframe and main window are on the same domain. Cheers, Ivan On Sep 14, 9:15 pm, ximo wallas igguan...@yahoo.com wrote: Is this possible? Been trying but doesn't seem to work...
[jQuery] JQuery Thickbox help
Does anyone know how to manipulate the speed/transition time for both the FadeIn and FadeOut animations for ThickBox?
[jQuery] Re: how to get post data from a page loaded in iframe in parent page
Hi Nils, I must say that I didn't quite understand what you want - do you want to access data in another iframe? If so - are the iframes (or windows) which are communicating loaded from the same domain or from different domains? I suggest you check out http://www.jibbering.com/faq/#frameRef and the pmrpc library (http://code.google.com/p/pmrpc/). Pmrpc is a library that enables calling procedures in other iframes/windows even if those iframes/windows are loaded from different domains. Hope that helps, Ivan On Sep 25, 6:17 am, Nils nils.niran...@gmail.com wrote: how to get post data from a page loaded iniframein parent page
[jQuery] Re: Ajax results?
Thanks guys Michael, that link is very helpful. I got the numbers a bit mixed up, it should be around 25 result items each made up of 12 elements with around 12 pieces of information from db/json. - so yes, 300 elements total. If you don't mind me asking, I'd like you guys to give me your opinion on what I'm doing at the moment. I'm making a search page that has filters and the way I have it set up, I use jQuery to retrieve filter values and pass them along via AJAX to the server. The server takes these values, stores them in a session then outputs the results, which then is html()'ed to my results DIV. (I'll be switching to JSON) What do you guys think? Currently the whole search page is a bit javascript dependent (both the actual input/manipulation of filters and the instant update of the results). Should I be really worried about people who have javascript disabled? Thanks! On Sep 30, 4:34 pm, Michael Geary m...@mg.to wrote: 25 x 12 sounds closer to 300 elements? Either way, it's easy to generate that much stuff in JavaScript and get good performance, if you're careful about how you write the code. Here's a post with some tips and optimized code for a similar task: http://groups.google.com/group/jquery-en/msg/121203c4216c34ee If you follow the basic pattern in that code it should be plenty fast. You could post the specific HTML you want to generate along with the JSON format you plan to use if you have any questions about how to make it go fast. -Mike On Wed, Sep 30, 2009 at 9:01 AM, Toaster mr.toas...@gmail.com wrote: Thank you for your reply James In regards to the JSON vs HTML, would the browser have any problems creating 25 results items each with 12 pieces of information from JSON? (it'd be more of less 120 elements being appended)
[jQuery] Re: tooltip - how do i remove an existing tooltip
How about giving the tooltip an identifier, such as a class name, and remove the class once the validation is satisfied. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of cgipson Sent: Friday, October 02, 2009 1:51 PM To: jQuery (English) Subject: [jQuery] tooltip - how do i remove an existing tooltip Hi, I am using tooltip in my application as a way to notify the user as to what kind of error was found in thier input field. My question is, once that error is resolved and validated correctly, is there a way i can remove the tooltip?
[jQuery] Re: keeping table header fix
On Sep 16, 2:16 am, macsig sigbac...@gmail.com wrote: Hello guys, I'd like to know if there is a way to keep a table header fixed on top of a div while I scroll the table rows. I have a div high 200px and the table itself is around 300px so when I scroll down I'd like to always see the header on top. I already use for the table tablesorter so the solution must be compatible with that plug-in. There is a very discouraging discussion on this topic going on at comp.lang.javascript: http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/61f3829aaec3bb0a?hl=en# In the most recent post, the guy is telling me (imperiously) to use position:fixed. Now I'm going to tell him why I can't. It'll be interesting to see what happens next. I'm positive there are folks who have faced this problem. Will they appear? We shall see. -- ben -- ben
[jQuery] Re: .ajax() with dataType: 'jsonp' will not use error callback if request fails
I think this is a known limitation of jsonp as a technique, not a bug with jquery itself. Jsonp works by appending a script tag to the DOM, whose src attribute points to the URL you specify. The URL is expected to wrap a json object in a function call to the function you specify, and the returned text is evaluated using eval().. Just like script tags that are returned in the sorce HTML, if the server doesn't respond (or throws a 404), I don't think there is a way to determine that through JavaScript. $.ajax() can determine other error scenarios by inspecting the XHR object, but jsonp doesn't use XHR. Hope that helps. On Oct 1, 12:18 pm, mrandall randall...@gmail.com wrote: I'm using an .ajax() call to do a jsonp request to another domain. When the user is not logged in, however, the server will return a 401 error. Unfortunately, this causes my .ajax() call to fail _without_ calling the error callback. Is this a known bug? Here is my code: $.ajax({ url: appData.API.workout.get, data: {date: App.formatDate(date)}, dataType: 'jsonp', success: function(json) { Data = json; model.buildOrderedWorkout(); myCP.Workout.View.initialize(); }, error: function(xOptions, error) { Controller.requestError(xOptions, error); } }); Is there a way to get this request to not fail? I also looked at the jquery-jsonp plugin, but that didn't really work and did not return the http status codes. Thanks for your help, Mike
[jQuery] Form Plugin issue with multiple submit buttons
Hi I have a form with several submit buttons. I've used $(#myform).ajaxForm(options) method to make the form submittable with ajax. the problem is that no matter what button I click the form data is the same and input type=submit element is not included into the form data, as if it were not a successul control. so at this point form doesn't work as expected. is there a way to convey information of which button was clicked with the form plugin? Thanks. Evgeny.
[jQuery] Re: animation only when mouseover
Any ideas? THANKS On Sep 21, 12:47 pm, Macsig sigbac...@gmail.com wrote: Thanks, it stops the animation but now there is an other issue. Is there a way to keep the same speed for thescrolling? I mean if I set the duration up and down and I go down just, let us say, for 1/3 of the div when I scroll back up the animation is 3 times slower since the duration is hardcoded. The first idea I had is to determine where I'm in the div in order to define a constant speed but I can find anything about that on scrollTo documentation. For instance, let us say I want to have 5000 as a duration for the entirescrolling, when I'm 20% down I want to set the up speed = 5000x0.2 and down speed =5000x0.8. In this way the speed is constant. THANKS On Sep 21, 8:01 am, Robin Abony robin.ab...@gmail.com wrote: Hello macsig! I haven't really had time to look into your problem, but after a quick look through the documentation i found thishttp://docs.jquery.com/Effects/stop#clearQueuegotoEnd Perhaps that could work for you? I imagine something along the lines of : $('#down_button').mouseover(function(){ $('#text').scrollTo('100%', {axis:'y', duration: 5000}); }).mouseout(function(){ $('#text').stop(); }); Give that a try! On 21 Sep, 03:49, macsig sigbac...@gmail.com wrote: Hi there, I'm trying to use scrollTo in oder to scroll vertically a div. I want to use 2 anchors, one to go up and the other to go down and I need that the effect works ONLY when the mouse is over the anchor (when I move it out the animation has to stop). How can I achieve so? For instance the code below scrolls correctly down but it doesn't stop until the end even if I move out the mouse. $('#down_button').mouseover(function(){ $('#text').scrollTo('100%', {axis:'y', duration: 5000}); }).mouseout(function(){ }); THANKS Sig
[jQuery] Re: Form Plugin issue with multiple submit buttons
I've used $(#myform).ajaxForm(options) method to make the form submittable with ajax. the problem is that no matter what button I click the form data is the same and input type=submit element is not included into the form data, as if it were not a successul control. so at this point form doesn't work as expected. is there a way to convey information of which button was clicked with the form plugin? Please post a link to your page. There is likely something wrong with the markup.
[jQuery] Re: Passing arguments to an ajax call that returns automagically
I have a bunch of ajax events that are fired one after an other to fill different spots on the page. Hence it's important that I know which dom element each on of the resulting data is supposed to belong to. I was wondering if there is a way I can pass the id of each element into the call so that it gets returned automagically without any intervention by the server? In YUI I can pass any number of arguments to an axax call and these areguments are available as part of the response. You can achieve this sort of thing using closures. For example: function getData(id, url) { $.ajax({ url: url, success: function(data) { $(id).html(data); } }); }
[jQuery] Re: .ajax() with dataType: 'jsonp' will not use error callback if request fails
I think this is a known limitation of jsonp as a technique, not a bug with jquery itself. Jsonp works by appending a script tag to the DOM, whose src attribute points to the URL you specify. The URL is expected to wrap a json object in a function call to the function you specify, and the returned text is evaluated using eval().. Just like script tags that are returned in the sorce HTML, if the server doesn't respond (or throws a 404), I don't think there is a way to determine that through JavaScript. $.ajax() can determine other error scenarios by inspecting the XHR object, but jsonp doesn't use XHR. Hope that helps. Here's a jsonp function that handles errors and timeouts: http://gist.github.com/82181
[jQuery] Re: Pick different effects with jquery
Try taking a look at the wonderful cycle plugin of Mike Alsup: http://malsup.com/jquery/cycle/options.html Thanks for the comment. Here's another page to look at that shows the variety of effects available: http://www.malsup.com/jquery/cycle/multi.html
[jQuery] Re: ajax submit upload file firebug... no answer
Effectively after uploading file we can't see any response in firebug. (You can see an example in the official website of jquery form pluginhttp://malsup.com/jquery/form/#code-samples) You won't see the response from a file upload displayed on the Firebug console tab because that request does not use ajax. You will see the request/response on Firebug's Net tab however. And in the response i call a script with script src=script.js type=text/javascript/script My page get this file well but i have a javascript error on the $ of $(document).ready(function() {... This is due to the nature of how the file upload is performed. As I said, it does not use ajax, however it simulates ajax by performing a native form submit and pointing the response to a dynamic iframe. So the response is actually received in a different document, and then the form plugin extracts it and passes the response data to your success handler. That dynamic iframe document does not have direct access to the jQuery $ fn. One way around this, as is noted in the documentation, is to return this response data inside a textarea element (which the plugin knows how to handle). Another way to handle this is to embed you logic in the main document.