[jQuery] Re: dans blog jquery calculate installment
it just not runs at all. Anyway, I managed to write my own function to do similar purpose. Thanks for getting back On Sep 28, 12:55 pm, RobG robg...@gmail.com wrote: On Sep 28, 1:26 pm, runrunforest craigco...@gmail.com wrote: Hi, I've got a script from dansblog (link herehttp://blog.pengoworks.com/index.cfm/2008/1/23/jQuery-Calculation-Plu...) I copied and presented it as below, its doesn't work. What I've done incorrectly ? Most such scripts are worth what you pay for them, or less. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head script type=text/javascript src=js/jquery-1.3.2.min.js/script script type=text/javascript $(function(){ // bind the recalc function to the quantity fields $(input[name^=qty_item_]).bind(keyup, recalc); Using the keyup event is not a good idea. You are running the listener far more often that it needs to, you only need to run it when the user has finished their input for a particular field (e..g. run it using blur). function recalc(){ // run the calc() method on each of the total fields $([id^=total_item]).calc( Where is calc() defined? User input should always be validated - what will happen if they input # instead of 3? // the equation to use for the calculation qty * price, // we now define the values for the variables defined in the Beware of those who talk about we. equation above { // instead of using a static value, we use a jQuery object which grabs all the quantities It grabs exactly the same set of inputs every single time the keyup event occurs. Why would you do that except to waste CPU cycles? qty: $(input[name^=qty_item_]), // now we define the jQuery object which reads in the price from the table cell price: $([id^=price_item_]) }, // this function is execute after the calculation is completed, which allows us to // add formatting to our value function (s){ // return the number as a dollar amount return $ + s.toFixed(2); In some implementations, toFixed is buggy, though likely it doesn't matter here. URL:http://www.merlyn.demon.co.uk/js-rndg1.htm#toF }, // once all calculations are completed, we execute the code below function ($this){ // now we get the sum() of all the values we just calculated var sum = $this.sum(); Where is sum() defined? Does it validate user input? // now that we have the grand total, we must update the screen $(#grandTotal).text( // round the results to 2 digits $ + sum.toFixed(2) If the values have already been rounded, their sum does not need to be rounded again. ); } ); }}); /script /head body table width=500 col style=width: 50px; / col / col style=width: 60px; / col style=width: 110px; / tr th Qty /th th align=left Product /th th Price /th th Total /th /tr tr td align=center input type=text name=qty_item_1 id=qty_item_1 value=1 size=2 / /td td /td td align=center id=price_item_1 $39.99 /td Somewhere there must be a calc() function that takes an input element and gets its value, then any other type of element and gets its text content (or value perhaps), strips off the currency sign, multiplies the two and returns the result. Maybe it does some checking of the values it's been passed. Or not. It seems strange that a function called sum would not do rounding. How is invalid input handled? -- Rob
[jQuery] Re: show()ing thousands of divs
@sid Can we have the url to the page which shows your solution ? -- DBJ ps: an simple generic and reusable async worker : function do_async( callback , optional_host, optional_microseconds ) { var that = optional_host || this ; var timer_id = window.setTimeout ( function () { try { callback.call(that) ; } catch ( x ) { window.alert(Exception in callback for do_async:\n + x.message ) ; } window.clearTimeout(timer_id); timer_id = null ; } , optional_microseconds || 1 // 1 is default ) ; } // Call the above with your this if you need to : function sids_object () { this.name = Sid ; this.ordinal = 1 ; this.work = function () { alert( this.name + : + (this.ordinal+ +) + is done.); } this.async_work = function() { do_async( this.work, this, 1000 ) } } var as = new sids_object() ; for( var j = 0 ; j 10; j++ ) as.async_work() ; Call with any other instance you want to pass as 'this' : do_async( function() { alert( +this ) ; }, new Date() ) ;
[jQuery] Re: Mailing list for general JavaScript discussion?
You'll never find a more wretched hive of scum and villainy. and javascript. On Sep 27, 5:12 pm, Karl Swedberg k...@englishrules.com wrote: If you have a very thick skin and can look past the ranting of arrogant know-it-alls, the comp.lang.javascript Usenet group can be a great resource. You can access it through Google Groups, too:http://groups.google.com/group/comp.lang.javascript/topics --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Sep 27, 2009, at 8:23 AM, Hunt Jon wrote: Hi all, I know it's a bit off-topic, but which mailing list do you use for general JavaScript discussion. As we know, JavaScript is an OOP language which has getting more and more attention on a daily basis from programmers and designers. Where could I have in-depth discussions on JavaScript, Ajax, OOP, server-side JavaScript, etc...? Jon
[jQuery] check if checkbox is checked dynamicallyH
Hi, I have a html like this input type=checkbox id=priority /span class=presult0 USD/ span I want when checkbox is checked, the span will have 500 USD. When checkbox is unchecked the span will return 0 USD. This is what I've got, have no idea why not work. if ($('#priority').is(':checked')) { $('.presult').text('500 USD'); }else { $('.presult').text(''); }
[jQuery] Cookies
I'm really stuck in adding the cookies plugin to the sortables script I have below. I don't even know where to begin. Can anyone help? script type=text/javascript $(document).ready(function(){ $(.column).sortable({ connectWith: '.column', cursor: 'hand', handle: 'h3', opacity: 0.8, change: function(e, i) { // Post data back to server or update cookie } }); $(.widget).append('div class=close/div'); $(.close).click(function(){ if ($(this).parent().data(collapsed)==yes) { $(this).parent().data(collapsed,no); $(this).parent().animate({height:$(this).parent().data (height)}); } else { $(this).parent().data(height,$(this).parent().height()); $(this).parent().data(collapsed,yes); $(this).parent().animate({height:30}); } }); }); /script Many thanks in advance. Craig
[jQuery] Re: Every post I make, I get an mail error.
I got some of those, too, not long ago, but haven't had any recently. From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Charlie Griefer Sent: Sunday, September 27, 2009 10:05 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Every post I make, I get an mail error. Karl - This was happening to me a few weeks ago (from a different @localhost address). Rey took care of it. He may have taken care of this one as well. On Sun, Sep 27, 2009 at 5:51 PM, Karl Swedberg k...@englishrules.com wrote: Hmmm. I just searched through all jquery-en members and couldn't find r...@localhost listed. Maybe one of the other admins already deleted it? --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Sep 26, 2009, at 4:38 PM, Scott Haneda wrote: I believe what happens, is there is a bad address in the group, so when you post a message to the list, it is sent out to all subscribers. Final-Recipient: rfc822; r...@localhost Original-Recipient: rfc822;r...@localhost Action: failed Status: 5.3.0 If an email is sent from the group to r...@localhost, it will bounce, and I am guessing it is bouncing back to the group. Some people are getting this backscatter, and others are not. If I were to look at my server logs, I would bet I see it, but I have my server set to block messages that are backscatter, or have bogus recipients and destinations. The list admin needs to find r...@localhost I believe, that would solve it, though I think the issue is technically deeper than that quick fix. -- Scott * If you contact me off list replace talklists@ with scott@ * On Sep 26, 2009, at 8:10 AM, Charlie wrote: I posted this issue into Google Groups help forum yesterday, only response so far group won't recognize your email address which is not true Will see what happens Bertilo Wennergren wrote: evo wrote: Everytime I post to this group through thunderbird, I get a undelivered mail message sent back, everytime. This has only started happening recently and I can't find any info about it anywhere. Just want to know if this is happening to anyone else (as it's only when I post to this group) I get those too. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: Prevent jagged text in IE
deprecating the UA interrogation was a bad move imo, simply because sometimes you legitimately want to know what browser somebody is running, rather than whether it has support for feature-x. it takes 5 mins to write a function to find the browser/os/whatever (and five seconds to copy/paste one you wrote previously ;-) ) but not having to re-write that is very much the point of jquery. a framework shouldn't dictate what you can do, but provide tools to do it as efficiently as possible. checking for a combination of features that you know are supported in the current version of chrome to find that browser isn't particularly efficient both in terms of code and maintenance. as for the x-browser animation issue, i suspect (rightly or wrongly) this would get filed away as an IE bug rather than a feature of jquery. On Sep 27, 8:09 pm, Kevin Dalman kevin.dal...@gmail.com wrote: If browser-detection can't be used, then subsititute code to detect the filter attribute instead. The exact syntax is not important... I believe jQuery SHOULD handle this cross-browser animation issue because it is common to the majority of users. It is clearly a deficiency when jQuery's own contributors have to override core methods to address it. The choices are: A) Update jQuery to handle this issue natively, or; B) Continue using hacks for animations in the world's most common browser. I'm interested in opinions on this, particularly from the regular jQuery contributors. /Kevin On Sep 27, 4:20 am, ryan.j ryan.joyce...@googlemail.com wrote: browser sniffing is already deprecated in favour of feature sniffing, it's unlikely code using it will be added.
[jQuery] Re: Lightbox or PrettyPhoto or Fancybox break when submitting content with jEditable plugin
i think this is actually a problem with the Django app that's powering our site, not javascript or jquery plugins.
[jQuery] remove anything thats not number
Hi, I have a value that include word letter and some sign such as $. I want to remove all of them just keep the number. For example: i want $99,99 USD become 99 or 100 can someone please give the function
[jQuery] Re: remove anything thats not number
parseFloat( yourStr ) On Sep 28, 10:18 am, runrunforest craigco...@gmail.com wrote: Hi, I have a value that include word letter and some sign such as $. I want to remove all of them just keep the number. For example: i want $99,99 USD become 99 or 100 can someone please give the function
[jQuery] Re: remove anything thats not number
you said 99 or 100, parseFloat will give 99.99 from your example - if you specifically wanted an integer you could parseInt( yourString ) and that will round up. To round a number down use Math.floor on the floating-point number parseFloat gives. On Sep 28, 10:22 am, ryan.j ryan.joyce...@googlemail.com wrote: parseFloat( yourStr ) On Sep 28, 10:18 am, runrunforest craigco...@gmail.com wrote: Hi, I have a value that include word letter and some sign such as $. I want to remove all of them just keep the number. For example: i want $99,99 USD become 99 or 100 can someone please give the function
[jQuery] Re: Cookies
I forgot to say that the script above is based on the JQuery UI framework. On Sep 28, 9:32 am, craigeves craige...@googlemail.com wrote: I'm really stuck in adding the cookies plugin to the sortables script I have below. I don't even know where to begin. Can anyone help? script type=text/javascript $(document).ready(function(){ $(.column).sortable({ connectWith: '.column', cursor: 'hand', handle: 'h3', opacity: 0.8, change: function(e, i) { // Post data back to server or update cookie } }); $(.widget).append('div class=close/div'); $(.close).click(function(){ if ($(this).parent().data(collapsed)==yes) { $(this).parent().data(collapsed,no); $(this).parent().animate({height:$(this).parent().data (height)}); } else { $(this).parent().data(height,$(this).parent().height()); $(this).parent().data(collapsed,yes); $(this).parent().animate({height:30}); } }); }); /script Many thanks in advance. Craig
[jQuery] Re: remove anything thats not number
thank you very much On Sep 28, 4:26 pm, ryan.j ryan.joyce...@googlemail.com wrote: you said 99 or 100, parseFloat will give 99.99 from your example - if you specifically wanted an integer you could parseInt( yourString ) and that will round up. To round a number down use Math.floor on the floating-point number parseFloat gives. On Sep 28, 10:22 am, ryan.j ryan.joyce...@googlemail.com wrote: parseFloat( yourStr ) On Sep 28, 10:18 am, runrunforest craigco...@gmail.com wrote: Hi, I have a value that include word letter and some sign such as $. I want to remove all of them just keep the number. For example: i want $99,99 USD become 99 or 100 can someone please give the function
[jQuery] Re: show()ing thousands of divs
presumably the HTML for these ~3k records are being generated server- side somewhere - can you not split/group the results before they hit the browser? On Sep 28, 3:36 am, Sid nikhil...@gmail.com wrote: Thanks, guys. Michael G., your solution worked like a charm. setTimeout seems to mess with the context (this is not recognized within the function). But that was a minor problem. I just assigned this to a global variable and used that variable inside setTimeout's function. A couple of other solutions were discussed here:http://stackoverflow.com/questions/1267275/jquery-show-is-delayed-in-... I also liked the approach of using show()'s callback function: $ ('#foo').show( 0, function() { doOtherThings(); } ); Mike M., Interesting suggestions to use CSS. But even with the CSS approach, I doubt if performance will be any better. Looping through each of the 3000 divs and calling $(this).show() or $(this).addClass('showing') will probably take the same amount of time. What I ended up doing (and it did speed things up) is not use jQuery for hide/show. I now store basic info about all 3000 entities in a JS object { ent0 : { property1 : 'abc', property2 : 'xyz' }, ent1 : { prop1: '123', ..},..}. The HTML for each div is similar, so I just generate a whole new HTML with only the entities I want to show. Then replace the existing HTML with the new HTML. On Sep 27, 2:07 pm, Mike McNally emmecin...@gmail.com wrote: If there's a need to selectively show particular elements out of a large number, something to try while experimenting with performance improvements is to construct a CSS block dynamically and then update it. You'd put together the CSS as a stream of #randomDiv0021 { display: block; } CSS statements, and then just jam the whole thing into a style block (which you can access by id attribute. I know that you have to update style blocks with a particular function in IE (Firefox lets you use innerHTML pretty much anywhere, but IE will throw an unknown error exception); it may be innerText or cssText or something like that. Perhaps jQuery deals with that for us. Building and updating a CSS block en masse may or may not be faster than explicit calls to show() and hide(). If you do build a CSS block, make sure you do it by constructing an array of strings and then joinging it together rather than repeatedly appending to a single accumulating string. On Sun, Sep 27, 2009 at 1:56 PM, Michael Geary m...@mg.to wrote: You would expect the waitingdiv to appear instantaneously because the bottleneck is in show()ing all 3000 divs. But for some reason it takes a really long time for it to show up. And then it's gone in a flash and all 3000 divs appear. That's because the browser doesn't refresh the page while JavaScript code is running. It waits until all your code finishes running and then refreshes with all the changes you've made. If you want to see partial results, use setTimeout() to delay part of your code: doOneThing(); setTimeout( function() { doAnotherThing(); }, 1 ); Now you will see the results of doOneThing() immediately, before doAnotherThing() is called. Mike M's tip sounds good for hiding and showing all your divs, but I think that leaves the problem of hiding and showing a subset of them according to your filter. I don't have any ideas for you on that, though - I'd have to see a test page to get a better idea of what it's doing. -Mike On Sat, Sep 26, 2009 at 10:25 PM, Sid nikhil...@gmail.com wrote: I have a page with about 3000 (expected to grow to around 5000) floating divs. It's a list of entities. The page also has filters to allow the user to narrow down (no one wants to see 3000 items, of course). When all filters are removed, I want to show all 3000 divs. After every 2 of these divs, I also need to insert an additional div to clear the float. The problem is that $(div.mydivclass).show(); is taking a really long time. Any performance tips? The other interesting thing that's happening is this: $(body).append(waitingdiv);//Positioned in the center of the screen with a wait gif and Please wait message if(appliedfilters.length==0) //No filters. Show all divs $(div.mydivclass).show(); else { .. show only divs that meet filter criteria.. } insertClearingDivs();//Insert a div to clear the float after every 2 visible divs $(div#waitingdiv).remove(); You would expect the waitingdiv to appear instantaneously because the bottleneck is in show()ing all 3000 divs. But for some reason it takes a really long time for it to show up. And then it's gone in a flash and all 3000 divs appear. Incidentally, this also happens when the first filter is applied. In that case, the filter usually narrows down 3000 items to about 100. -- Turtle, turtle, on the ground, Pink and shiny, turn around.
[jQuery] Ajax check username - ASP and Access DB
Hi, Reasonably new to web building. I am now just updating my site with jQuery (first time user). I would like to implement an Ajax username checker on a new client registration form. All the tutorials and examples I can find use jQuery and php. Unfortunately, I have taught myself Access and ASP and have no knowledge of php. At this stage I want to stick with ASP and Access and look to upgrade the DB as another project. Can any body point me in the right direction to obtain some code. Kind regards.
[jQuery] Simple Jquery AJAX post
Could soneone please show me an example of a simple ajax post to a coldfusion page, with a loading graphic? I cant find an appropriate example in the documentation. Thankyou
[jQuery] Validate
Hi, Is there any way to use Jquery Validate with default (intial) values in a input, and use the script to ignore the intial value as an option. Eg. input name=sub_name type=text id=sub_name value=Name: class=autoclear required title=Name / The system should ignore 'Name:' as an acceptable value. Regards
[jQuery] [Tablesorter] Problem with unsortable columns
Hi everybody, I started using the great tablesorter 2.0 plugin. In one of my tables all but two columns should be sortable. I use the following code to achieve this: script type=text/javascript $(function() { $(#spiele).tablesorter({sortList:[[1,1]], locale: 'de', headers: { // assign the secound column (we start counting zero) 6: { // disable it by setting the property sorter to false sorter: false }, // assign the third column (we start counting zero) 7: { // disable it by setting the property sorter to false sorter: false } },widgets: ['zebra']}); }); /script That works fine. The only issue is, that the up-down arrows are still visible in ALL columns. Shouldn't they disappear in those two, where I set sorter to false? Martin
[jQuery] keepp getting NaN vlue
Hi, I'm making a calculator for freight customer It seems I'm on the right path. But there is two bugs i need help. The TOTAL TO PAY value always seem to appear as NaN at first instead of default 3. And the function of TOTAL TO PAY only work after checkbox is checkd, I need it work regarding to changing of input value not just checkbox. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=http://ajax.googleapis.com/ajax/ libs/jquery/1.3.1/jquery.min.js/script script type=text/javascript $(function(){ $('input[type=text]').bind(keyup,calculate); calculate(); function calculate() { var firstkm = 3, nextkm = 1000; var distance = $('#distance').val(); if(distance 1){$('.dresult').text(firstkm + nextkm*(distance-1) + 'USD');} else {$('.dresult').text(firstkm + 'USD');} var weight = $('#weight').val(), perkg = 5000; if(weight 5) {$('.wresult').text((weight-5)*5000 + 'USD');} else {$('.wresult').text(0 + 'USD');} total(); } $('#priority').change(function(){ if ($(this).attr('checked') === true) { $('.presult').text('5000 USD'); } else { $('.presult').text('0 USD'); } total(); }); function total() { var r1 = parseInt($('.dresult').text()), r2 = parseInt($ ('.wresult').text()), r3 = parseInt($('.presult').text()); $('.grandtotal').text(r1 + r2 + r3); }; }); /script /head body Distanceinput type=text id=distance value=1 /span class=dresult/spannbsp;nbsp;nbsp; first km is 30k USD, the next kms is 1k USD eachbr / Weightinput type=text id=weight /span class=wresult/ spannbsp;nbsp;nbsp; no extra fee for good under 5kgbr / urgentinput type=checkbox id=priority /span class=presult/ spannbsp;nbsp;nbsp; urgent good 5k USD extrabr / divtotal to pay: span class=grandtotal/span/div /body /html
[jQuery] Re: keepp getting NaN vlue
runrunforest ha scritto: Hi, I'm making a calculator for freight customer It seems I'm on the right path. But there is two bugs i need help. The TOTAL TO PAY value always seem to appear as NaN at first instead of default 3. And the function of TOTAL TO PAY only work after checkbox is checkd, I need it work regarding to changing of input value not just checkbox. I didn't chek all of your code, but remember: $('#distance').val(); returns a string, not an int. Bye -- gianiaz.net - web solutions via piedo, 58 - 23020 tresivio (so) - italy +39 347 7196482
[jQuery] How to handle dynamic clicks?
Hi, I am trying to get the correct div from a form I did (I intentionally left the brackets open so it displays here) span id=doedit_$comment[commentid] a onclick= return getCommentID($comment[commentid]) and for the jQuery $(document).ready(function() { function getCommentID(cid) { $(#doedit_ + cid).click(function() { $(div#newcomment).slideUp(slow); $(div#editcomment_ + cid).slideDown(slow); } }); But nothing is happening. Please what is the proper syntax? Thank you -- View this message in context: http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25644199.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: check if checkbox is checked dynamicallyH
$('#priority').click(function(){ if( $(this).is(':checked') ) $('.presult').text('500 USD'); else $('.presult').text(''); }); On Mon, Sep 28, 2009 at 05:24, runrunforest craigco...@gmail.com wrote: Hi, I have a html like this input type=checkbox id=priority /span class=presult0 USD/ span I want when checkbox is checked, the span will have 500 USD. When checkbox is unchecked the span will return 0 USD. This is what I've got, have no idea why not work. if ($('#priority').is(':checked')) { $('.presult').text('500 USD'); }else { $('.presult').text(''); }
[jQuery] Re: webpage load lightbox with video
A quick google search provides this article as the first result: http://vidlivery.com/2008/nov/06/tutorials/quick-tip-create-video-gallery-thickbox keywords: thickbox tutorial flash video On Sep 27, 6:51 pm, Shravan Garlapati shravan0...@gmail.com wrote: Hi, I want the website to show a lighbox with video started as soon as it is loaded. I should also have an option to close the video. Can anybody please send me an example for this. Shravan.
[jQuery] Re: Mailing list for general JavaScript discussion?
Hi, I have used the SitePoint forums with some success. Here is the link to the Javascript forum: http://www.sitepoint.com/forums/forumdisplay.php?f=15 Good luck. On Sep 27, 8:23 am, Hunt Jon jona.hunt...@gmail.com wrote: Hi all, I know it's a bit off-topic, but which mailing list do you use for general JavaScript discussion. As we know, JavaScript is an OOP language which has getting more and more attention on a daily basis from programmers and designers. Where could I have in-depth discussions on JavaScript, Ajax, OOP, server-side JavaScript, etc...? Jon
[jQuery] Re: lavalamp category problem
There is a common template, but I'm not sure if the class category is addressed correctly in there. Would there normally be a correspondence between the classes in the template and the classes in lavahelper? Sorry if this is a dumb question. On Sep 26, 12:00 pm, Charlie charlie...@gmail.com wrote: is there a common php page template for the pages in question that is different from pages that do work? the classes for the lavahelper in the js don't seem to exist so first thought is the template php may not be adding them ksprague wrote:on this site:http://www.nrm.org/wordpress/when I go to a category view like thishttp://www.nrm.org/wordpress/category/current-exhibitions/the nicelavalampfeatures fall apart. I have dug into the .js on this but can't figure it out.here is the .js:jQuery.noConflict(); function kriesi_mainmenu(){jQuery(#nav a, #subnav a).removeAttr('title');jQuery( #nav ul ).css({display: none}); // Opera FixjQuery( #nav li).hover(function(){jQuery(this).find('ul:first:hidden').css({visibility: visible,display: none}).show(400); },function(){jQuery(this).find('ul:first').css({visibility: hidden}); }); } ///This functions checks on which subpage you are and applies the background to the main menu function lavahelper() {jQuery(#nav .current_page_item, #nav .current_page_parent, #nav .current_page_ancestor).addClass('current').removeClass (current_page_item).removeClass(current_page_parent).removeClass (current_page_ancestor); } function form_validation(){jQuery(.empty, .email).each(function(i){jQuery(this).bind(blur, function(){ var value =jQuery(this).attr(value); var check_for =jQuery(this).attr(class); var surrounding_element =jQuery(this).parent(p); var template_url =jQuery(meta[name=Cube_option1]).attr ('content');jQuery.ajax({ type: POST, url: template_url + /validate.php, data: value=+value+check_for=+check_for, beforeSend:function(){ surrounding_element.attr(class,).addClass (ajax_loading); }, error:function(){ surrounding_element.attr(class,).addClass(ajax_alert); }, success: function(response){ if(response == true){ surrounding_element.attr(class,).addClass(ajax_valid); }else{ surrounding_element.attr(class,).addClass(ajax_false); } } }); }); }); } function validate_all(){ var my_error;jQuery(.ajax_form #send).bind(click, function(){ my_error = false;jQuery(.empty, .email).each(function(i){ var value =jQuery(this).attr(value); var check_for =jQuery(this).attr(class); var surrounding_element =jQuery(this).parent(p); var template_url =jQuery(meta[name=Cube_option1]).attr ('content');jQuery.ajax({ type: POST, url: template_url + /validate.php, data: value=+value+check_for=+check_for, beforeSend:function(){ surrounding_element.attr(class,).addClass (ajax_loading); }, error:function(){ surrounding_element.attr(class,).addClass(ajax_alert); }, success: function(response){ if(response == true){ surrounding_element.attr(class,).addClass(ajax_valid); }else{ surrounding_element.attr(class,).addClass(ajax_false); my_error = true; } if(jQuery(.empty, .email).length == i+1){ if(my_error == false){jQuery(#ajax_form).slideUp(400); var yourname =jQuery(#name).attr('value'); var email =jQuery(#email).attr('value'); var website =jQuery(#website).attr('value'); var message =jQuery(#message).attr('value'); var myemail =jQuery(#myemail).attr('value'); var myblogname =jQuery(#myblogname).attr('value');jQuery.ajax({ type: POST, url: template_url + /send.php, data: Send=trueyourname=+yourname+email=+email +website=+website+message=+message+myemail=+myemail +myblogname=+myblogname, success: function(response){jQuery(#ajax_response).css({display:none}).html (response).slideDown(400); } }); } } } }); }); return false; }); }jQuery(document).ready(function(){ kriesi_mainmenu(); lavahelper();jQuery(#nav).lavaLamp({ fx: easeOutCubic, speed: 700 }); form_validation(); validate_all(); });jQuery(window).load(function(){ // starts executing after all images have loaded to ensure best performancejQuery(#transition-container).toolani_transition({block_size: 80,display_for:6000}); //dont set lower then 6000 or it will produce errors }); /** *LavaLamp- A menu plugin forjQuerywith cool hover effects. * @requiresjQueryv1.1.3.1 or above * *http://gmarwaha.com/blog/?p=7* * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com) * Dual licensed under the MIT and GPL licenses: *http://www.opensource.org/licenses/mit-license.php*http://www.gnu.org/licenses/gpl.html* * Version: 0.2.0 * RequiresJquery1.2.1 from version 0.2.0 onwards. * Forjquery1.1.x, use version 0.1.0 oflavalamp*/ (function(jQuery) {jQuery.fn.lavaLamp= function(o) { o =jQuery.extend({ fx: linear, speed: 500, click: function() {} }, o || {}); return this.each(function() { var me =jQuery(this), noop = function(){}, jQueryback =jQuery('li class=backdiv class=left/ div/li').appendTo(me), jQueryli =jQuery(li, this), curr
[jQuery] Re: IE: Cursor still displays hourglass symbol after unblocking
Do you want a quick fix? Edit blockui.js: Add els[1].style.cursor = 'default'; After var els = full ? $('body').children().filter('.blockUI') : $ ('.blockUI', el); Grtz, On Sep 28, 2:08 am, MorningZ morni...@gmail.com wrote: around this bug within the actual JQueryBlockUIplugin Wow, really? it's pretty obvious this is IE not changing the cursor unless themouseis moved, not a bug in the plugin, as it changes the CSS Amazing how rude people are using coe provided-to/supported them free of charge On Sep 27, 10:29 am, Eeyore145 mgkos2...@yahoo.com wrote: Thanks Mike, but please let me know if there are any plans to work around this bug within the actual JQueryBlockUIplugin. Thanks On Sep 26, 9:23 am, Mike Alsup mal...@gmail.com wrote: I have tried adding to both the overlayCSS and css overrides acursor of 'default' but it doesn't seem to do anything. http://www.malsup.com/jquery/block/sep26.html
[jQuery] Re: keepp getting NaN vlue
further to that, you can do var distance = parseInt($(#distance.val(), 10); Using the radix (the second parameter - 10 in this case), forces the specific conversion you'd like. When dealing with dates at least, leaving out the radix can sometimes result in abnormal behavior that is VERY hard to troubleshoot. Oh, if the number is not an integer, use parseFloat() instead of parseInt(). (er, sry if this is TOOO basic.. :) ) Shawn Giovanni Battista Lenoci wrote: runrunforest ha scritto: Hi, I'm making a calculator for freight customer It seems I'm on the right path. But there is two bugs i need help. The TOTAL TO PAY value always seem to appear as NaN at first instead of default 3. And the function of TOTAL TO PAY only work after checkbox is checkd, I need it work regarding to changing of input value not just checkbox. I didn't chek all of your code, but remember: $('#distance').val(); returns a string, not an int. Bye
[jQuery] Re: keepp getting NaN vlue
I made some changes and it's now working, the problem was for the var's r2 and r3 on load there were no values for it to find, causing the NaN. here are my changes: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / /head body Distanceinput type=text id=distance value=1 / span class=dresult/spannbsp;nbsp;nbsp; first km is 30k USD, the next kms is 1k USD eachbr / Weightinput type=text id=weight value=0 / span class=wresult/spannbsp;nbsp;nbsp; no extra fee for good under 5kgbr / urgentinput type=checkbox id=priority / span class=presult/spannbsp;nbsp;nbsp; urgent good 5k USD extrabr / divtotal to pay: span class=grandtotal/span/div script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js;/script script type=text/javascript $(function(){ $('input[type=text]').bind(keyup,calculate); calculate(); function calculate() { var firstkm = 3, nextkm = 1000; var distance = $('#distance').val(); if(distance 1){$('.dresult').text(firstkm + nextkm*(distance-1) + 'USD');} else {$('.dresult').text(firstkm + 'USD');} var weight = $('#weight').val(), perkg = 5000; if(weight 5) {$('.wresult').text((weight-5)*5000 + 'USD');} else {$('.wresult').text(0 + 'USD');} total(); } $('.presult').text('0 USD'); total(); $('#priority').change(function(){ if ($(this).attr('checked') == true) { $('.presult').text('5000 USD'); } else { $('.presult').text('0 USD'); } total(); }); function total() { var r1 = parseInt($('.dresult').text()), r2 = parseInt($('.wresult').text()), r3 = parseInt($('.presult').text()); $('.grandtotal').text(r1 + r2 + r3); }; }); /script /body /html Shawn wrote: further to that, you can do var distance = parseInt($(#distance.val(), 10); Using the radix (the second parameter - 10 in this case), forces the specific conversion you'd like. When dealing with dates at least, leaving out the radix can sometimes result in abnormal behavior that is VERY hard to troubleshoot. Oh, if the number is not an integer, use parseFloat() instead of parseInt(). (er, sry if this is TOOO basic.. :) ) Shawn Giovanni Battista Lenoci wrote: runrunforest ha scritto: Hi, I'm making a calculator for freight customer It seems I'm on the right path. But there is two bugs i need help. The TOTAL TO PAY value always seem to appear as NaN at first instead of default 3. And the function of TOTAL TO PAY only work after checkbox is checkd, I need it work regarding to changing of input value not just checkbox. I didn't chek all of your code, but remember: $('#distance').val(); returns a string, not an int. Bye
[jQuery] Re: Cookies
It might help if you'd mention what it is you want to *do* with the plugin. On Mon, Sep 28, 2009 at 3:32 AM, craigeves craige...@googlemail.com wrote: I'm really stuck in adding the cookies plugin to the sortables script I have below. I don't even know where to begin. Can anyone help? script type=text/javascript $(document).ready(function(){ $(.column).sortable({ connectWith: '.column', cursor: 'hand', handle: 'h3', opacity: 0.8, change: function(e, i) { // Post data back to server or update cookie } }); $(.widget).append('div class=close/div'); $(.close).click(function(){ if ($(this).parent().data(collapsed)==yes) { $(this).parent().data(collapsed,no); $(this).parent().animate({height:$(this).parent().data (height)}); } else { $(this).parent().data(height,$(this).parent().height()); $(this).parent().data(collapsed,yes); $(this).parent().animate({height:30}); } }); }); /script Many thanks in advance. Craig -- Turtle, turtle, on the ground, Pink and shiny, turn around.
[jQuery] Re: Cookies
Sorry. Stupid me. I want the script to remember the position of the divs and the collapsible state. Thanks Craig On Sep 28, 1:44 pm, Mike McNally emmecin...@gmail.com wrote: It might help if you'd mention what it is you want to *do* with the plugin. On Mon, Sep 28, 2009 at 3:32 AM, craigeves craige...@googlemail.com wrote: I'm really stuck in adding the cookies plugin to the sortables script I have below. I don't even know where to begin. Can anyone help? script type=text/javascript $(document).ready(function(){ $(.column).sortable({ connectWith: '.column', cursor: 'hand', handle: 'h3', opacity: 0.8, change: function(e, i) { // Post data back to server or update cookie } }); $(.widget).append('div class=close/div'); $(.close).click(function(){ if ($(this).parent().data(collapsed)==yes) { $(this).parent().data(collapsed,no); $(this).parent().animate({height:$(this).parent().data (height)}); } else { $(this).parent().data(height,$(this).parent().height()); $(this).parent().data(collapsed,yes); $(this).parent().animate({height:30}); } }); }); /script Many thanks in advance. Craig -- Turtle, turtle, on the ground, Pink and shiny, turn around.
[jQuery] Re: Ajax check username - ASP and Access DB
Take an example page in php that you want to mimic, and simply have asp send back to the browser the same information On Sep 28, 3:58 am, factoringcompare firstfacto...@googlemail.com wrote: Hi, Reasonably new to web building. I am now just updating my site with jQuery (first time user). I would like to implement an Ajax username checker on a new client registration form. All the tutorials and examples I can find use jQuery and php. Unfortunately, I have taught myself Access and ASP and have no knowledge of php. At this stage I want to stick with ASP and Access and look to upgrade the DB as another project. Can any body point me in the right direction to obtain some code. Kind regards.
[jQuery] How to add some string in attributes?
If I have a tag image like this.. img alt=My Account src=/images/menu-my-account.png/ and when hover that image I want became like this img alt=My Account src=/images/menu-my-account-hover.png/ How to code this with jquery? Thanks
[jQuery] Synchronous call in JQuery?
Is there a JQuery way to execute a custom function 'after' another custom function is executed? The second function must wait until the first one has finished. (Not asynchronous but synchronous) Important: I don't want place the call to the second function in the first one. for example: doSomething1(); doSomething2(); function doSomething1() { } function doSomething2() { }
[jQuery] Re: Simple Jquery AJAX post
i did try ealer to send a reply but that did not seem to apper so heres a shorter version http://docs.jquery.com/Ajax has everything you need, to make a loading image come up on start you can just ether in your click function inlude $(.loading).show(); or use the event http://docs.jquery.com/Ajax/ajaxStart#callback then use the stop http://docs.jquery.com/Ajax/ajaxStop#callback then its just a $.post(url,data,callback) i normally do my data in a {} so {peram1 : 'test'} etc ending up with somthing like $.post ('example.php',{peram1 : 'test'},function(data){ alert('hello')}); On Sep 28, 10:58 am, mattastic mharris...@yahoo.co.uk wrote: Could soneone please show me an example of a simple ajax post to a coldfusion page, with a loading graphic? I cant find an appropriate example in the documentation. Thankyou
[jQuery] Re: Simple Jquery AJAX post
http://docs.jquery.com/Ajax has everything you need but a simple example would be... $(document).ready(function(){ $.ajaxStart(function(){ $('.loading').show(); }); $.ajaxStop(function(){ $('.loading').hide(); }); //i have trouble with the post permiters so i always do it the {} way but you can just pass a array $.post('example.php',{peram1 : 'hello',peram2 : 'world', myval : $ ('.myinput').val()},function(data){ alert($(data).find('result').text()); }); }); if the return was xml ie messageresultit saved/result/message then you would get it saved in a alert watch some of the functions though if you tell it to expect something as it will just brake. .loading i am useing as your loading graphic or a div containing it etc using css to absolutely position it or putting it wherever you want it. you can do better things if you want but if you just trying things for the first time this will do :P On Sep 28, 10:58 am, mattastic mharris...@yahoo.co.uk wrote: Could soneone please show me an example of a simple ajax post to a coldfusion page, with a loading graphic? I cant find an appropriate example in the documentation. Thankyou
[jQuery] Re: How to add some string in attributes?
$(function(){ $(img).bind(mouseover,function(){ $(this).attr(src,/images/menu-my-account-hover.png); }); }); but this is the worst way you can do rollovers. You should be doing this in pure CSS, and the best way would be to use an image sprite. Teddy Hong wrote: If I have a tag image like this.. img alt=My Account src=/images/menu-my-account.png/ and when hover that image I want became like this img alt=My Account src=/images/menu-my-account-hover.png/ How to code this with jquery? Thanks
[jQuery] Re: Synchronous call in JQuery?
Your question doesn't make very much sense. In your example, doSomething2 would execute after doSomething1 finished, so it is synchronous. Perhaps you could provide an example of what you're actually trying to do? --Erik On Mon, Sep 28, 2009 at 6:24 AM, Mesquite koen.buekenh...@gmail.com wrote: Is there a JQuery way to execute a custom function 'after' another custom function is executed? The second function must wait until the first one has finished. (Not asynchronous but synchronous) Important: I don't want place the call to the second function in the first one. for example: doSomething1(); doSomething2(); function doSomething1() { } function doSomething2() { }
[jQuery] Re: Mouseout event problem
Start of the week bump... On Sep 26, 7:28 pm, James A jamesaal...@gmail.com wrote: Hi there, Real newbie to jquery but things are starting to become clearer. I am building a website for a studio i have just set up -http://www.birchstudio.co.uk/test- and am having trouble with the menu which is using a slide plugin. I have got the menu area (the white part at the top of the site) to slide when the mouse enters the area, this is fine and i have got the area to slide back once the mouse leaves the area, this also works, but then when the slide function has finished and the menu slid back as far as it is suppose to the menu drops down again. Would any one know how to stop this happening? I can post the code on here if that helps (i have linked the website page where the problem is happening -http://www.birchstudio.co.uk/test) Best, James
[jQuery] Re: Synchronous call in JQuery?
I'm trying to load a JQuery dialog containing content from the backend. JQuery places this dialog vertically in the middle of the page when the dialog open call is executed. But the moment that happens, another function is still loading data and parsing that data in the dialog. So it is not completed yet. This way, the dialog is not centered in the middle of the page because the height will more that initially calculated. That's why I want to wait to open the dialog until I'm finished. Is the only way placing this call at the end of the flow? On 28 sep, 16:39, Erik Beeson erik.bee...@gmail.com wrote: Your question doesn't make very much sense. In your example, doSomething2 would execute after doSomething1 finished, so it is synchronous. Perhaps you could provide an example of what you're actually trying to do? --Erik On Mon, Sep 28, 2009 at 6:24 AM, Mesquite koen.buekenh...@gmail.com wrote: Is there a JQuery way to execute a custom function 'after' another custom function is executed? The second function must wait until the first one has finished. (Not asynchronous but synchronous) Important: I don't want place the call to the second function in the first one. for example: doSomething1(); doSomething2(); function doSomething1() { } function doSomething2() { }
[jQuery] Re: Synchronous call in JQuery?
http://plugins.jquery.com/project/ajaxqueue maybe this is what you want. On Mon, Sep 28, 2009 at 10:55 PM, Mesquite koen.buekenh...@gmail.com wrote: I'm trying to load a JQuery dialog containing content from the backend. JQuery places this dialog vertically in the middle of the page when the dialog open call is executed. But the moment that happens, another function is still loading data and parsing that data in the dialog. So it is not completed yet. This way, the dialog is not centered in the middle of the page because the height will more that initially calculated. That's why I want to wait to open the dialog until I'm finished. Is the only way placing this call at the end of the flow? On 28 sep, 16:39, Erik Beeson erik.bee...@gmail.com wrote: Your question doesn't make very much sense. In your example, doSomething2 would execute after doSomething1 finished, so it is synchronous. Perhaps you could provide an example of what you're actually trying to do? --Erik On Mon, Sep 28, 2009 at 6:24 AM, Mesquite koen.buekenh...@gmail.com wrote: Is there a JQuery way to execute a custom function 'after' another custom function is executed? The second function must wait until the first one has finished. (Not asynchronous but synchronous) Important: I don't want place the call to the second function in the first one. for example: doSomething1(); doSomething2(); function doSomething1() { } function doSomething2() { } -- Best Regards, David Shen http://twitter.com/davidshen84/ http://meme.yahoo.com/davidshen84/
[jQuery] jquery not working on content loaded by ajax
I've got the following code: $(document).ready(function() { $(a.market).click(function (event) { alert( $(this).attr(id) ); }); }); it works on a test link that i have in a div a href='#' class='market' id='1234'Test/a But when I load new data (it's loaded by a menu in an iframe, and the data loads perfectly to the parent div where the test link resides) when I click on these links (which are identical in format), nothing happens. is there anything I'm missing?
[jQuery] Special for you!
http://cfi.iflywestwind.com/nEACWal3iJ.html
[jQuery] validate plugin step by step form
Hi, I'm creating a step by step form using jquery ui tabs and validation plugin, the problem is that I've got just one form ( and I have to ) so on first step the form is validated but all errors an others steps are displayed. I'm using an approach of http://jquery.bassistance.de/validate/demo/multipart/ but I've got specific messages and validations. Something like var v=$(#saverForm).validate( { debug: true, focusCleanup : false, rules: { signupDetails.hasUnderstoodDeclaration : required, applicantType: required, title: required, }, messages:{ signupDetails.hasUnderstoodDeclaration : Please accept The terms and conditions, applicantType: Please select an option., title: Please choose your title., firstname: Please enter your first name., lastname: Please enter your surname., }); and a lot more fields. Is there any way I can add rules an messages to the form rather than add them to the fields?? or can I create different form.validate() variables and then call them depending oin which step am I? something like v[0] =$(#saverForm).validate( some set of 2 rules for example ) v[1] =$(#saverForm).validate( some set of 10 rules for example different than above) Many thanks
[jQuery] Re: show()ing thousands of divs
3000 divs are freaking huge. it would be better to do it in ajax and load them by chunks instead of putting it all in one huge HTML page. On Sep 28, 6:17 pm, ryan.j ryan.joyce...@googlemail.com wrote: presumably the HTML for these ~3k records are being generated server- side somewhere - can you not split/group the results before they hit the browser? On Sep 28, 3:36 am, Sid nikhil...@gmail.com wrote: Thanks, guys. Michael G., your solution worked like a charm. setTimeout seems to mess with the context (this is not recognized within the function). But that was a minor problem. I just assigned this to a global variable and used that variable inside setTimeout's function. A couple of other solutions were discussed here:http://stackoverflow.com/questions/1267275/jquery-show-is-delayed-in-... I also liked the approach of using show()'s callback function: $ ('#foo').show( 0, function() { doOtherThings(); } ); Mike M., Interesting suggestions to use CSS. But even with the CSS approach, I doubt if performance will be any better. Looping through each of the 3000 divs and calling $(this).show() or $(this).addClass('showing') will probably take the same amount of time. What I ended up doing (and it did speed things up) is not use jQuery for hide/show. I now store basic info about all 3000 entities in a JS object { ent0 : { property1 : 'abc', property2 : 'xyz' }, ent1 : { prop1: '123', ..},..}. The HTML for each div is similar, so I just generate a whole new HTML with only the entities I want to show. Then replace the existing HTML with the new HTML. On Sep 27, 2:07 pm, Mike McNally emmecin...@gmail.com wrote: If there's a need to selectively show particular elements out of a large number, something to try while experimenting with performance improvements is to construct a CSS block dynamically and then update it. You'd put together the CSS as a stream of #randomDiv0021 { display: block; } CSS statements, and then just jam the whole thing into a style block (which you can access by id attribute. I know that you have to update style blocks with a particular function in IE (Firefox lets you use innerHTML pretty much anywhere, but IE will throw an unknown error exception); it may be innerText or cssText or something like that. Perhaps jQuery deals with that for us. Building and updating a CSS block en masse may or may not be faster than explicit calls to show() and hide(). If you do build a CSS block, make sure you do it by constructing an array of strings and then joinging it together rather than repeatedly appending to a single accumulating string. On Sun, Sep 27, 2009 at 1:56 PM, Michael Geary m...@mg.to wrote: You would expect the waitingdiv to appear instantaneously because the bottleneck is in show()ing all 3000 divs. But for some reason it takes a really long time for it to show up. And then it's gone in a flash and all 3000 divs appear. That's because the browser doesn't refresh the page while JavaScript code is running. It waits until all your code finishes running and then refreshes with all the changes you've made. If you want to see partial results, use setTimeout() to delay part of your code: doOneThing(); setTimeout( function() { doAnotherThing(); }, 1 ); Now you will see the results of doOneThing() immediately, before doAnotherThing() is called. Mike M's tip sounds good for hiding and showing all your divs, but I think that leaves the problem of hiding and showing a subset of them according to your filter. I don't have any ideas for you on that, though - I'd have to see a test page to get a better idea of what it's doing. -Mike On Sat, Sep 26, 2009 at 10:25 PM, Sid nikhil...@gmail.com wrote: I have a page with about 3000 (expected to grow to around 5000) floating divs. It's a list of entities. The page also has filters to allow the user to narrow down (no one wants to see 3000 items, of course). When all filters are removed, I want to show all 3000 divs. After every 2 of these divs, I also need to insert an additional div to clear the float. The problem is that $(div.mydivclass).show(); is taking a really long time. Any performance tips? The other interesting thing that's happening is this: $(body).append(waitingdiv);//Positioned in the center of the screen with a wait gif and Please wait message if(appliedfilters.length==0) //No filters. Show all divs $(div.mydivclass).show(); else { .. show only divs that meet filter criteria.. } insertClearingDivs();//Insert a div to clear the float after every 2 visible divs $(div#waitingdiv).remove(); You would expect the waitingdiv to appear instantaneously because the bottleneck is in show()ing all 3000 divs. But for some reason it takes
[jQuery] Re: jquery not working on content loaded by ajax
SOLVED: $(a.market).live('click', function(event) { alert( $(this).attr(id) ); }); easy! On Sep 28, 4:05 pm, black.horizons black.horiz...@gmail.com wrote: I've got the following code: $(document).ready(function() { $(a.market).click(function (event) { alert( $(this).attr(id) ); }); }); it works on a test link that i have in a div a href='#' class='market' id='1234'Test/a But when I load new data (it's loaded by a menu in an iframe, and the data loads perfectly to the parent div where the test link resides) when I click on these links (which are identical in format), nothing happens. is there anything I'm missing?
[jQuery] Re: show()ing thousands of divs
For 3000 divs and a lot more in the future, then I recommend you do an AJAX to load the content when the user scrolls down. Examples: Slashdot (slashdot.org) Google Reader I know there are jQuery plugins to help you load on scroll, please Google. Good Luck, William Chang http://www.williamchang.org http://www.babybluebox.com On Sep 28, 10:54 am, Raymond Ho rym...@gmail.com wrote: 3000 divs are freaking huge. it would be better to do it in ajax and load them by chunks instead of putting it all in one huge HTML page. On Sep 28, 6:17 pm, ryan.j ryan.joyce...@googlemail.com wrote: presumably the HTML for these ~3k records are being generated server- side somewhere - can you not split/group the results before they hit the browser? On Sep 28, 3:36 am, Sid nikhil...@gmail.com wrote: Thanks, guys. Michael G., your solution worked like a charm. setTimeout seems to mess with the context (this is not recognized within the function). But that was a minor problem. I just assigned this to a global variable and used that variable inside setTimeout's function. A couple of other solutions were discussed here:http://stackoverflow.com/questions/1267275/jquery-show-is-delayed-in-... I also liked the approach of using show()'s callback function: $ ('#foo').show( 0, function() { doOtherThings(); } ); Mike M., Interesting suggestions to use CSS. But even with the CSS approach, I doubt if performance will be any better. Looping through each of the 3000 divs and calling $(this).show() or $(this).addClass('showing') will probably take the same amount of time. What I ended up doing (and it did speed things up) is not use jQuery for hide/show. I now store basic info about all 3000 entities in a JS object { ent0 : { property1 : 'abc', property2 : 'xyz' }, ent1 : { prop1: '123', ..},..}. The HTML for each div is similar, so I just generate a whole new HTML with only the entities I want to show. Then replace the existing HTML with the new HTML. On Sep 27, 2:07 pm, Mike McNally emmecin...@gmail.com wrote: If there's a need to selectively show particular elements out of a large number, something to try while experimenting with performance improvements is to construct a CSS block dynamically and then update it. You'd put together the CSS as a stream of #randomDiv0021 { display: block; } CSS statements, and then just jam the whole thing into a style block (which you can access by id attribute. I know that you have to update style blocks with a particular function in IE (Firefox lets you use innerHTML pretty much anywhere, but IE will throw an unknown error exception); it may be innerText or cssText or something like that. Perhaps jQuery deals with that for us. Building and updating a CSS block en masse may or may not be faster than explicit calls to show() and hide(). If you do build a CSS block, make sure you do it by constructing an array of strings and then joinging it together rather than repeatedly appending to a single accumulating string. On Sun, Sep 27, 2009 at 1:56 PM, Michael Geary m...@mg.to wrote: You would expect the waitingdiv to appear instantaneously because the bottleneck is in show()ing all 3000 divs. But for some reason it takes a really long time for it to show up. And then it's gone in a flash and all 3000 divs appear. That's because the browser doesn't refresh the page while JavaScript code is running. It waits until all your code finishes running and then refreshes with all the changes you've made. If you want to see partial results, use setTimeout() to delay part of your code: doOneThing(); setTimeout( function() { doAnotherThing(); }, 1 ); Now you will see the results of doOneThing() immediately, before doAnotherThing() is called. Mike M's tip sounds good for hiding and showing all your divs, but I think that leaves the problem of hiding and showing a subset of them according to your filter. I don't have any ideas for you on that, though - I'd have to see a test page to get a better idea of what it's doing. -Mike On Sat, Sep 26, 2009 at 10:25 PM, Sid nikhil...@gmail.com wrote: I have a page with about 3000 (expected to grow to around 5000) floating divs. It's a list of entities. The page also has filters to allow the user to narrow down (no one wants to see 3000 items, of course). When all filters are removed, I want to show all 3000 divs. After every 2 of these divs, I also need to insert an additional div to clear the float. The problem is that $(div.mydivclass).show(); is taking a really long time. Any performance tips? The other interesting thing that's happening is this: $(body).append(waitingdiv);//Positioned in the center of the screen with a
[jQuery] Re: How to handle dynamic clicks?
You shouldn't need to use a named function, or an inline onclick. If you can move that id attribute into the a tag itself, you could do: spana href=# id=doedit_$comment[commentid] ... /a/span and then your jQuery would be: $(document).ready(function() { $('a[id^=doedit_]').click(function() { alert(this.id); -- shows that you have a handle on the specific element that triggered the click return false; }); }) On Mon, Sep 28, 2009 at 4:34 AM, lionel28 lmarte...@haitiwebs.net wrote: Hi, I am trying to get the correct div from a form I did (I intentionally left the brackets open so it displays here) span id=doedit_$comment[commentid] a onclick= return getCommentID($comment[commentid]) and for the jQuery $(document).ready(function() { function getCommentID(cid) { $(#doedit_ + cid).click(function() { $(div#newcomment).slideUp(slow); $(div#editcomment_ + cid).slideDown(slow); } }); But nothing is happening. Please what is the proper syntax? Thank you -- View this message in context: http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25644199.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Access a checkbox in a datalist
Hello, I'm trying access a checkbox in a datalist. Here is the datalist: asp:DataList runat=server ID=dlUserList onitemdatabound=dlUserList_ItemDataBound ItemTemplate table class=UserList tr td asp:Label ID=lblForenames runat=server Text='%# Eval (Forenames) %' CssClass=personForenames/asp:Label /td td input id=chkUserActive type=checkbox checked= '%# Eval (Active) %' CssClass=personActive / /td td a id=lnkEdit class=button editButton personID=%# Eval (PersonID) % Edit/a /td /tr /table /ItemTemplate /asp:DataList Here is the code behind: $(document).ready(function() { initActions(); }); function initActions() { $(.editButton).click(function(e) { showUserDetails(this); }); } function showUserDetails(currentEditButton) { var currentUser; currentUser = $(currentEditButton).closest(.UserList); var Forenames = ($(currentUser).find(.personForenames).html()); // is active if ($('currentUser.personActive').is(':checked')) { //do something } } I can get the html value of the lblForenames, but $ ('currentUser.personActive') returns null. I also tried $('currentUser #chkUserActive'), but it does not return the checkbox either. I cannot figure out why the same method could access a label but not a checkbox? I would be most appreciated if someone could please shine some light on this issue. Many thanks, Lihong
[jQuery] Re: Ajax check username - ASP and Access DB
OK, I am trying to get this example to work : http://papermashup.com/jquery-php-mysql-username-availability-checker/ This is the php code I can't mimic: ?php include(dbConnector.php); $connector = new DbConnector(); $username = trim(strtolower($_POST['username'])); $username = mysql_escape_string($username); $query = SELECT username FROM usernameCheck WHERE username = '$username' LIMIT 1; $result = $connector-query($query); $num = mysql_num_rows($result); echo $num; mysql_close(); On Sep 28, 2:16 pm, MorningZ morni...@gmail.com wrote: Take an example page in php that you want to mimic, and simply have asp send back to the browser the same information On Sep 28, 3:58 am, factoringcompare firstfacto...@googlemail.com wrote: Hi, Reasonably new to web building. I am now just updating my site with jQuery (first time user). I would like to implement an Ajax username checker on a new client registration form. All the tutorials and examples I can find use jQuery and php. Unfortunately, I have taught myself Access and ASP and have no knowledge of php. At this stage I want to stick with ASP and Access and look to upgrade the DB as another project. Can any body point me in the right direction to obtain some code. Kind regards.- Hide quoted text - - Show quoted text -
[jQuery] Re: show()ing thousands of divs
@Mike M. You're still looping through 3000 jQuery objects and invoking the setClass() method. I haven't tried it but I suspected it will take roughly the same time as the show() method. It does seem logical that the actual showing of the div will be faster if the browser does it natively. The question which part is the bottleneck - looping through 3000 jQuery objects or actually show()ing them one by one? If I can experiment and find out, I will - and I'll post the results. @DBJ The page is not live yet. It's still in dev so I can't share the URL right now. @Ryan @Raymond @William Yes, the 3000 divs are initially generated server-side. And yes, no one really cares to see that many. The only reason I'm doing it is so search engines can crawl everything. Initially, I had wanted to put them in a 2-column table instead of using divs. But the show/hide approach with jQuery would mess with the layout when hiding individual table cells. So I switched to floating divs instead. Now that I'm regenerating the HTML instead of using show/ hide, I'm wondering whether I should switch back to table layout instead. It will also mean not needing those clearing divs, which is nice. Tangentially related question: When you have an event listener that you tag to 3000 elements, is it better to use function names? i.e. instead of $(div.myDivClass a).click(function(){...}); you should say var myFunc = function(){..}; $(div.myDivClass a).click(myFunc); My guess is that the 2nd approach conserves memory but I could be over- analyzing. What do you guys think? On Sep 28, 9:39 am, William Chang diehardb...@gmail.com wrote: For 3000 divs and a lot more in the future, then I recommend you do an AJAX to load the content when the user scrolls down. Examples: Slashdot (slashdot.org) Google Reader I know there are jQuery plugins to help you load on scroll, please Google. Good Luck, William Changhttp://www.williamchang.orghttp://www.babybluebox.com On Sep 28, 10:54 am, Raymond Ho rym...@gmail.com wrote: 3000 divs are freaking huge. it would be better to do it in ajax and load them by chunks instead of putting it all in one huge HTML page. On Sep 28, 6:17 pm, ryan.j ryan.joyce...@googlemail.com wrote: presumably the HTML for these ~3k records are being generated server- side somewhere - can you not split/group the results before they hit the browser? On Sep 28, 3:36 am, Sid nikhil...@gmail.com wrote: Thanks, guys. Michael G., your solution worked like a charm. setTimeout seems to mess with the context (this is not recognized within the function). But that was a minor problem. I just assigned this to a global variable and used that variable inside setTimeout's function. A couple of other solutions were discussed here:http://stackoverflow.com/questions/1267275/jquery-show-is-delayed-in-... I also liked the approach of using show()'s callback function: $ ('#foo').show( 0, function() { doOtherThings(); } ); Mike M., Interesting suggestions to use CSS. But even with the CSS approach, I doubt if performance will be any better. Looping through each of the 3000 divs and calling $(this).show() or $(this).addClass('showing') will probably take the same amount of time. What I ended up doing (and it did speed things up) is not use jQuery for hide/show. I now store basic info about all 3000 entities in a JS object { ent0 : { property1 : 'abc', property2 : 'xyz' }, ent1 : { prop1: '123', ..},..}. The HTML for each div is similar, so I just generate a whole new HTML with only the entities I want to show. Then replace the existing HTML with the new HTML. On Sep 27, 2:07 pm, Mike McNally emmecin...@gmail.com wrote: If there's a need to selectively show particular elements out of a large number, something to try while experimenting with performance improvements is to construct a CSS block dynamically and then update it. You'd put together the CSS as a stream of #randomDiv0021 { display: block; } CSS statements, and then just jam the whole thing into a style block (which you can access by id attribute. I know that you have to update style blocks with a particular function in IE (Firefox lets you use innerHTML pretty much anywhere, but IE will throw an unknown error exception); it may be innerText or cssText or something like that. Perhaps jQuery deals with that for us. Building and updating a CSS block en masse may or may not be faster than explicit calls to show() and hide(). If you do build a CSS block, make sure you do it by constructing an array of strings and then joinging it together rather than repeatedly appending to a single accumulating string. On Sun, Sep 27, 2009 at 1:56 PM, Michael Geary m...@mg.to wrote: You would expect the waitingdiv to appear instantaneously because the bottleneck is in show()ing all 3000 divs.
[jQuery] Re: ajaxQueue not aborting ajax calls with Autocomplete
Anyone have any ideas about this? I'm stuck on this. Thanks On Sep 22, 2:47 pm, jmunning jasonmunn...@gmail.com wrote: Hi all, I am using the bassistance autcomplete plugin version 1.1 along with the bundled ajaxQueue.js file. When text is inputted into the autocomplete, it seems to be keeping the ajax calls open and loading even though they never resolve -- as shown by a loading indicator which is stuck and in the Firebug console. It looks to me like the ajaxQueue plugin is supposed to fix this but it doesn't seem to be aborting. I can't for the life of me figure out what the problem is or how to resolve it. Does anyone have suggestions of what I could look for? It seems to come down to this section in ajaxQueue.js: [code] case abort: if ( pendingRequests[port] ) { pendingRequests[port].abort(); } return pendingRequests[port] = ajax.apply(this, arguments); [/code] If I put an if statement on the line containing the 'abort' command then I can see that that command is not completing. Not sure why though. Here is my code: [code] $(#suggest).autocomplete('auto_data.php?table=patents', { width: 557, multiple: true, multipleSeparator: \n, matchSubset:false, //setting this to false causes entries to disappear after selected mustMatch: false, max: 20, delay: 0 }); [/code] And here is the site it is running on: http://www.xyggy.com Thanks for any help.
[jQuery] Re: ajaxQueue not aborting ajax calls with Autocomplete
Can you provide a testpage? Jörn On Mon, Sep 28, 2009 at 7:59 PM, jmunning jasonmunn...@gmail.com wrote: Anyone have any ideas about this? I'm stuck on this. Thanks On Sep 22, 2:47 pm, jmunning jasonmunn...@gmail.com wrote: Hi all, I am using the bassistance autcomplete plugin version 1.1 along with the bundled ajaxQueue.js file. When text is inputted into the autocomplete, it seems to be keeping the ajax calls open and loading even though they never resolve -- as shown by a loading indicator which is stuck and in the Firebug console. It looks to me like the ajaxQueue plugin is supposed to fix this but it doesn't seem to be aborting. I can't for the life of me figure out what the problem is or how to resolve it. Does anyone have suggestions of what I could look for? It seems to come down to this section in ajaxQueue.js: [code] case abort: if ( pendingRequests[port] ) { pendingRequests[port].abort(); } return pendingRequests[port] = ajax.apply(this, arguments); [/code] If I put an if statement on the line containing the 'abort' command then I can see that that command is not completing. Not sure why though. Here is my code: [code] $(#suggest).autocomplete('auto_data.php?table=patents', { width: 557, multiple: true, multipleSeparator: \n, matchSubset:false, //setting this to false causes entries to disappear after selected mustMatch: false, max: 20, delay: 0 }); [/code] And here is the site it is running on: http://www.xyggy.com Thanks for any help.
[jQuery] Re: show()ing thousands of divs
@Mike M. You're still looping through 3000 jQuery objects and invoking the setClass() method. I haven't tried it but I suspected it will take roughly the same time as the show() method. It does seem logical that the actual showing of the div will be faster if the browser does it natively. The question which part is the bottleneck - looping through 3000 jQuery objects or actually show()ing them one by one? If I can experiment and find out, I will - and I'll post the results. No, you're not. You completely misunderstood. You're calling setClass on the single container, not each contained div. -- Turtle, turtle, on the ground, Pink and shiny, turn around.
[jQuery] Re: Synchronous call in JQuery?
how about opening dialog in callback of AJAX loading the content? Xi Shen wrote: http://plugins.jquery.com/project/ajaxqueue maybe this is what you want. On Mon, Sep 28, 2009 at 10:55 PM, Mesquite koen.buekenh...@gmail.com wrote: I'm trying to load a JQuery dialog containing content from the backend. JQuery places this dialog vertically in the middle of the page when the dialog open call is executed. But the moment that happens, another function is still loading data and parsing that data in the dialog. So it is not completed yet. This way, the dialog is not centered in the middle of the page because the height will more that initially calculated. That's why I want to wait to open the dialog until I'm finished. Is the only way placing this call at the end of the flow? On 28 sep, 16:39, Erik Beeson erik.bee...@gmail.com wrote: Your question doesn't make very much sense. In your example, doSomething2 would execute after doSomething1 finished, so it is synchronous. Perhaps you could provide an example of what you're actually trying to do? --Erik On Mon, Sep 28, 2009 at 6:24 AM, Mesquite koen.buekenh...@gmail.com wrote: Is there a JQuery way to execute a custom function 'after' another custom function is executed? The second function must wait until the first one has finished. (Not asynchronous but synchronous) Important: I don't want place the call to the second function in the first one. for example: doSomething1(); doSomething2(); function doSomething1() { } function doSomething2() { }
[jQuery] Re: Mouseout event problem
Seems the mouseover/mouseout events are being triggered multiple times. You probably want to stop them from triggering if #panel is already being animated. Try something like this: jQuery(document).ready(function() { var $panel = jQuery('#panel'); // Expand Panel jQuery(#tab).mouseenter(function() { if (!$panel.is(':animated')) { $panel.slideDown(slow); } }); // Collapse Panel jQuery(#toppanel).mouseleave(function() { if (!$panel.is(':animated')) { $panel.slideUp(slow); } }); }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Sep 28, 2009, at 10:54 AM, James A wrote: Start of the week bump... On Sep 26, 7:28 pm, James A jamesaal...@gmail.com wrote: Hi there, Real newbie to jquery but things are starting to become clearer. I am building a website for a studio i have just set up -http://www.birchstudio.co.uk/test- and am having trouble with the menu which is using a slide plugin. I have got the menu area (the white part at the top of the site) to slide when the mouse enters the area, this is fine and i have got the area to slide back once the mouse leaves the area, this also works, but then when the slide function has finished and the menu slid back as far as it is suppose to the menu drops down again. Would any one know how to stop this happening? I can post the code on here if that helps (i have linked the website page where the problem is happening -http://www.birchstudio.co.uk/test) Best, James
[jQuery] Accordion UI height issue in Google Chrome
Hi All - Having another issue related to the accordion ui widget. In google chrome the initial inline height set by the accordion.js is calculating incorrectly on the initial page load. when the page is refreshed or you navigate to another page and then return, the height is set correctly. I am not sure why this is happening and I can't seem to see any other posts on the issue. I am thinking it has to do with with either my positioning css or my height declaration on the accordion div's. This only seems to occur in google chrome ( i have version 3.0.195.21) the other thing is that it only happens some of the time...? wtf? the page in question is here: http://ahepllc.com/ the accordion is on the right side in the main image area. I am viewing through vista. Have not checked in XP. any ideas or help will be much appreciated.
[jQuery] (jQuery validate) Remote Custom Message Problem on version 1.5.5
Hi.. I´ve upgraded my validate plugin to the 1.5.5 and I was having a problem: I have an email that needs to be checked if it already exists by ajax, and I was using the Validate Remote Method. In my old Validate version ( 1.5) it works great, but in the 1.5.5 version when I validate the email field it show primary the correct error message ( if it exists): Email n...@nono.com already exists. But if I type another existing email, no matter which one, I get the same message with the same email using the validator.format Email n...@nono.com already exists. I was debugging the code and I´ve found out that in line 932 the 1.5 version was written like that: errors[element.name] = response || validator.defaultMessage( element, remote ); And in the 1.5.5 like that: errors[element.name] = previous.message = response || validator.defaultMessage( element, remote ); So I removed the previous.message and it worked great. Does anyone knows why they added this previous.message to this line? And what exactly it does? Thanks
[jQuery] Re: Ajax check username - ASP and Access DB
This is the php code I can't mimic: Really? the code is super simple: - Open connection to the database - Take the posted value of username, trim it, and make lower case - Clean up the string to help prevent SQL injection attack - Take that username and check against the database - echo (Response.Write) the number of rows found - Close the database connection On Sep 28, 1:26 pm, factoringcompare firstfacto...@googlemail.com wrote: OK, I am trying to get this example to work :http://papermashup.com/jquery-php-mysql-username-availability-checker/ This is the php code I can't mimic: ?php include(dbConnector.php); $connector = new DbConnector(); $username = trim(strtolower($_POST['username'])); $username = mysql_escape_string($username); $query = SELECT username FROM usernameCheck WHERE username = '$username' LIMIT 1; $result = $connector-query($query); $num = mysql_num_rows($result); echo $num; mysql_close(); On Sep 28, 2:16 pm, MorningZ morni...@gmail.com wrote: Take an example page in php that you want to mimic, and simply have asp send back to the browser the same information On Sep 28, 3:58 am, factoringcompare firstfacto...@googlemail.com wrote: Hi, Reasonably new to web building. I am now just updating my site with jQuery (first time user). I would like to implement an Ajax username checker on a new client registration form. All the tutorials and examples I can find use jQuery and php. Unfortunately, I have taught myself Access and ASP and have no knowledge of php. At this stage I want to stick with ASP and Access and look to upgrade the DB as another project. Can any body point me in the right direction to obtain some code. Kind regards.- Hide quoted text - - Show quoted text -
[jQuery] Cant' read XML with IE 8
I'm reading the contents of an XML perfectly with FF but IE doesn't load the contents of the XML, everything seems to be ok, can somebody tell me what's wrong? var xml = $.ajax( { type: GET, url: xmlFile, dataType: xml, success: function(xml) { total = xml.getElementsByTagName(item).length; for(x=0;xtotal;x++) { title[x] = xml.getElementsByTagName(title)[x].firstChild.data; desc[x] = xml.getElementsByTagName(desc)[x].firstChild.data; }; } });
[jQuery] Checking/unchecking parent checkbox
Hi I've been using jQuery a couple of months and I'm really having a blast with it but need a little help with this problem. I have a table of records generated from a database that looks like this. Each record has a checkbox with a unique id followed by a person's name and employment status. trtd input type=checkbox id=rptDirectors_ctl19_chkDirectorName class=chkDirector checked=checked value=25094 / span id=rptDirectors_ctl19_lblDirFNameJ. Pedro/span span id=rptDirectors_ctl19_lblDirLNameReinhard/span (span id=rptDirectors_ctl19_lblRelStatus class=RelStatusRetired/span) /td/tr trtd input type=checkbox id=rptDirectors_ctl23_chkDirectorName class=chkDirector checked=checked value=29632 / span id=rptDirectors_ctl23_lblDirFNameJames B./span span id=rptDirectors_ctl23_lblDirLNameWilliams/span (span id=rptDirectors_ctl23_lblRelStatus class=RelStatusActive/ span) /td/tr When this checkbox (chkIncludeRetired) is checked/unchecked, the person's employment status (RelStatus) is checked and the entire row is hidden/shown. My jquery code below does this perfectly with no problems. However, in addition to hiding/showing the row. However, I also need the parent checkbox to be checked or unchecked. So if RelStatus == Retired then it's parent checkbox also needs to be unchecked else then it's parent checkbox needs to be checked. input id=chkIncludeRetired type=checkbox /i Exclude Retired Directors and Executives/i script language=javascript type=text/javascript $(document).ready(function() { $('#chkIncludeRetired').click( function() { $('.RelStatus').each(function() { if ($(#chkIncludeRetired).is(:checked)) { if ($(this).text() == Retired) $(this).parent().css('display', 'none'); } else { $(this).parent().css('display', 'block'); } }); }); }); /script Thank you very much.
[jQuery] how to submit a form after validation please ?
Can anyone tell me why my form action on line 113 does not fire after I get successful validation ? http://gist.github.com/195643 After the form validates I want it to POST submit to the url please.
[jQuery] Re: Checking/unchecking parent checkbox
I thought this would do it but no luck $(this).parents(checkbox:first).attr('checked', false); On Sep 28, 2:42 pm, evanbu...@gmail.com evanbu...@gmail.com wrote: Hi I've been using jQuery a couple of months and I'm really having a blast with it but need a little help with this problem. I have a table of records generated from a database that looks like this. Each record has a checkbox with a unique id followed by a person's name and employment status. trtd input type=checkbox id=rptDirectors_ctl19_chkDirectorName class=chkDirector checked=checked value=25094 / span id=rptDirectors_ctl19_lblDirFNameJ. Pedro/span span id=rptDirectors_ctl19_lblDirLNameReinhard/span (span id=rptDirectors_ctl19_lblRelStatus class=RelStatusRetired/span) /td/tr trtd input type=checkbox id=rptDirectors_ctl23_chkDirectorName class=chkDirector checked=checked value=29632 / span id=rptDirectors_ctl23_lblDirFNameJames B./span span id=rptDirectors_ctl23_lblDirLNameWilliams/span (span id=rptDirectors_ctl23_lblRelStatus class=RelStatusActive/ span) /td/tr When this checkbox (chkIncludeRetired) is checked/unchecked, the person's employment status (RelStatus) is checked and the entire row is hidden/shown. My jquery code below does this perfectly with no problems. However, in addition to hiding/showing the row. However, I also need the parent checkbox to be checked or unchecked. So if RelStatus == Retired then it's parent checkbox also needs to be unchecked else then it's parent checkbox needs to be checked. input id=chkIncludeRetired type=checkbox /i Exclude Retired Directors and Executives/i script language=javascript type=text/javascript $(document).ready(function() { $('#chkIncludeRetired').click( function() { $('.RelStatus').each(function() { if ($(#chkIncludeRetired).is(:checked)) { if ($(this).text() == Retired) $(this).parent().css('display', 'none'); } else { $(this).parent().css('display', 'block'); } }); });}); /script Thank you very much.
[jQuery] Re: Ajax check username - ASP and Access DB
I can’t get it to work. Something strange is happening. To manually check if the client side code is working I put “1” in the server side page with a .php extension and sure enough I can get the code to work. If I do the same with a .asp page it has no effect. Any thoughts what’s going on? On Sep 28, 7:36 pm, MorningZ morni...@gmail.com wrote: This is the php code I can't mimic: Really? the code is super simple: - Open connection to the database - Take the posted value of username, trim it, and make lower case - Clean up the string to help prevent SQL injection attack - Take that username and check against the database - echo (Response.Write) the number of rows found - Close the database connection On Sep 28, 1:26 pm, factoringcompare firstfacto...@googlemail.com wrote: OK, I am trying to get this example to work :http://papermashup.com/jquery-php-mysql-username-availability-checker/ This is the php code I can't mimic: ?php include(dbConnector.php); $connector = new DbConnector(); $username = trim(strtolower($_POST['username'])); $username = mysql_escape_string($username); $query = SELECT username FROM usernameCheck WHERE username = '$username' LIMIT 1; $result = $connector-query($query); $num = mysql_num_rows($result); echo $num; mysql_close(); On Sep 28, 2:16 pm, MorningZ morni...@gmail.com wrote: Take an example page in php that you want to mimic, and simply have asp send back to the browser the same information On Sep 28, 3:58 am, factoringcompare firstfacto...@googlemail.com wrote: Hi, Reasonably new to web building. I am now just updating my site with jQuery (first time user). I would like to implement an Ajax username checker on a new client registration form. All the tutorials and examples I can find use jQuery and php. Unfortunately, I have taught myself Access and ASP and have no knowledge of php. At this stage I want to stick with ASP and Access and look to upgrade the DB as another project. Can any body point me in the right direction to obtain some code. Kind regards.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: How to handle dynamic clicks?
Charlie, Thank you very much. I was able to do a split so I get actual value from your code and all is fine. I do whatever I want with php, but could you recommend a book for Javascript. Example: for the split I had to do a Google search :thinking: A book with all those easy code like yours, like the split would be great. Thanks again. Charlie Griefer wrote: You shouldn't need to use a named function, or an inline onclick. If you can move that id attribute into the tag itself, you could do: # ... and then your jQuery would be: $(document).ready(function() { $('a[id^=doedit_]').click(function() { alert(this.id); -- shows that you have a handle on the specific element that triggered the click return false; }); }) On Mon, Sep 28, 2009 at 4:34 AM, lionel28 lmarte...@haitiwebs.net wrote: Hi, I am trying to get the correct div from a form I did (I intentionally left the brackets open so it displays here) span id=doedit_$comment[commentid] a onclick= return getCommentID($comment[commentid]) and for the jQuery $(document).ready(function() { function getCommentID(cid) { $(#doedit_ + cid).click(function() { $(div#newcomment).slideUp(slow); $(div#editcomment_ + cid).slideDown(slow); } }); But nothing is happening. Please what is the proper syntax? Thank you -- View this message in context: http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25644199.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- View this message in context: http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25651479.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: How to handle dynamic clicks?
Hi Lionel: I've not bought a JavaScript book in ages. But the one that I learned from a while back is the JavaScript Bible by Danny Goodman. A quick Amazon search shows that a 7th Edition is in pre-release status (glad to hear) :) If you want a jQuery book, there are a couple of ways to go. There's jQuery in Action published by Manning. Learning jQuery 1.3 by Packt has some big jQuery names as authors. A new pdf book was just released (you can also pay extra for a bound copy) at http://jqueryenlightenment.com/. I bought that last week but haven't had a chance to get to it yet. On Mon, Sep 28, 2009 at 12:34 PM, lionel28 lmarte...@haitiwebs.net wrote: Charlie, Thank you very much. I was able to do a split so I get actual value from your code and all is fine. I do whatever I want with php, but could you recommend a book for Javascript. Example: for the split I had to do a Google search :thinking: A book with all those easy code like yours, like the split would be great. Thanks again. Charlie Griefer wrote: You shouldn't need to use a named function, or an inline onclick. If you can move that id attribute into the tag itself, you could do: # ... and then your jQuery would be: $(document).ready(function() { $('a[id^=doedit_]').click(function() { alert(this.id); -- shows that you have a handle on the specific element that triggered the click return false; }); }) On Mon, Sep 28, 2009 at 4:34 AM, lionel28 lmarte...@haitiwebs.net wrote: Hi, I am trying to get the correct div from a form I did (I intentionally left the brackets open so it displays here) span id=doedit_$comment[commentid] a onclick= return getCommentID($comment[commentid]) and for the jQuery $(document).ready(function() { function getCommentID(cid) { $(#doedit_ + cid).click(function() { $(div#newcomment).slideUp(slow); $(div#editcomment_ + cid).slideDown(slow); } }); But nothing is happening. Please what is the proper syntax? Thank you -- View this message in context: http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25644199.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- View this message in context: http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25651479.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: How to handle dynamic clicks?
Incidentally... not sure why you'd need to use split() for your needs there? Could you post some code or explain what your requirement is? You may be going about it the long way (or I may be misunderstanding what you're trying to do) :) On Mon, Sep 28, 2009 at 12:42 PM, Charlie Griefer charlie.grie...@gmail.com wrote: Hi Lionel: I've not bought a JavaScript book in ages. But the one that I learned from a while back is the JavaScript Bible by Danny Goodman. A quick Amazon search shows that a 7th Edition is in pre-release status (glad to hear) :) If you want a jQuery book, there are a couple of ways to go. There's jQuery in Action published by Manning. Learning jQuery 1.3 by Packt has some big jQuery names as authors. A new pdf book was just released (you can also pay extra for a bound copy) at http://jqueryenlightenment.com/. I bought that last week but haven't had a chance to get to it yet. On Mon, Sep 28, 2009 at 12:34 PM, lionel28 lmarte...@haitiwebs.netwrote: Charlie, Thank you very much. I was able to do a split so I get actual value from your code and all is fine. I do whatever I want with php, but could you recommend a book for Javascript. Example: for the split I had to do a Google search :thinking: A book with all those easy code like yours, like the split would be great. Thanks again. Charlie Griefer wrote: You shouldn't need to use a named function, or an inline onclick. If you can move that id attribute into the tag itself, you could do: # ... and then your jQuery would be: $(document).ready(function() { $('a[id^=doedit_]').click(function() { alert(this.id); -- shows that you have a handle on the specific element that triggered the click return false; }); }) On Mon, Sep 28, 2009 at 4:34 AM, lionel28 lmarte...@haitiwebs.net wrote: Hi, I am trying to get the correct div from a form I did (I intentionally left the brackets open so it displays here) span id=doedit_$comment[commentid] a onclick= return getCommentID($comment[commentid]) and for the jQuery $(document).ready(function() { function getCommentID(cid) { $(#doedit_ + cid).click(function() { $(div#newcomment).slideUp(slow); $(div#editcomment_ + cid).slideDown(slow); } }); But nothing is happening. Please what is the proper syntax? Thank you -- View this message in context: http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25644199.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- View this message in context: http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25651479.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: how to submit a form after validation please ?
Just a tip: You don't need to create a new validator function for your select. Instead of using value=none for your default option use value= and just add required:true to the rules. about your problem: Try to put the alert inside the submitHandler function to know if your form is validating. On Mon, Sep 28, 2009 at 15:53, slimshady bringmewa...@gmail.com wrote: Can anyone tell me why my form action on line 113 does not fire after I get successful validation ? http://gist.github.com/195643 After the form validates I want it to POST submit to the url please.
[jQuery] Re: Ajax check username - ASP and Access DB
Why do you have a page with a php extension? As for helping further, it would be a huge help if you post some non- working code... you could have a bad selector, bad syntax, who knows... On Sep 28, 3:15 pm, factoringcompare firstfacto...@googlemail.com wrote: I can’t get it to work. Something strange is happening. To manually check if the client side code is working I put “1” in the server side page with a .php extension and sure enough I can get the code to work. If I do the same with a .asp page it has no effect. Any thoughts what’s going on? On Sep 28, 7:36 pm, MorningZ morni...@gmail.com wrote: This is the php code I can't mimic: Really? the code is super simple: - Open connection to the database - Take the posted value of username, trim it, and make lower case - Clean up the string to help prevent SQL injection attack - Take that username and check against the database - echo (Response.Write) the number of rows found - Close the database connection On Sep 28, 1:26 pm, factoringcompare firstfacto...@googlemail.com wrote: OK, I am trying to get this example to work :http://papermashup.com/jquery-php-mysql-username-availability-checker/ This is the php code I can't mimic: ?php include(dbConnector.php); $connector = new DbConnector(); $username = trim(strtolower($_POST['username'])); $username = mysql_escape_string($username); $query = SELECT username FROM usernameCheck WHERE username = '$username' LIMIT 1; $result = $connector-query($query); $num = mysql_num_rows($result); echo $num; mysql_close(); On Sep 28, 2:16 pm, MorningZ morni...@gmail.com wrote: Take an example page in php that you want to mimic, and simply have asp send back to the browser the same information On Sep 28, 3:58 am, factoringcompare firstfacto...@googlemail.com wrote: Hi, Reasonably new to web building. I am now just updating my site with jQuery (first time user). I would like to implement an Ajax username checker on a new client registration form. All the tutorials and examples I can find use jQuery and php. Unfortunately, I have taught myself Access and ASP and have no knowledge of php. At this stage I want to stick with ASP and Access and look to upgrade the DB as another project. Can any body point me in the right direction to obtain some code. Kind regards.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Playing with jquery animate
Hi Been playing a bit with jquey animate, here is a sample of an animated header im working on for portfolio section of my upcoming site. http://www.todnn.com/pixelani/portfolio.htm -- Armand Datema CTO SchwingSoft
[jQuery] IE and DOM issues
Hi all, I've been wrangling with trying to get my jquery-powered global nav to work consistently in IE8 (in Compatibility Mode) and IE6 and 7, but with no luck. You can view the site here: http://67.23.44.204/ The top nav (Products, Inspirations, etc. should each have a set of subnavs that show up when you hover over them with mouse) works sometimes, and other times not. I recognize that the issue is with all the code that appears in my $(document).ready(fn) statements, and I've tried moving the relevant statement to the bottom of the body section, but still to no avail. It seems to work when I execute the code with window.onload, but I'm trying to avoid using that. Does anyone have any suggestions on how to get IE6, 7 and 8 in Compatibility Mode to execute the jquery code correctly (i.e. after the DOM is loaded)? Any guidance would be much appreciated. thanks, Yazan
[jQuery] Re: Ajax check username - ASP and Access DB
OK, thank you for taking the time out to look at this issue for me. Ok this is the code client side page: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / titleAjax Username Checker - Using JQuery/title style #username{ padding:3px; font-size:18px; border:3px #CCC solid; } #tick{display:none} #cross{display:none} /style script type=text/javascript src=Sitefiles-N/ jquery.formwizard-0.9.8/./jquery-1.3.2.js/script script $(document).ready(function(){ $('#username').keyup(username_check); }); function username_check(){ var username = $('#username').val(); if(username == || username.length 4){ $('#username').css('border', '3px #CCC solid'); $('#tick').hide(); }else{ jQuery.ajax({ type: POST, url: check10.asp, data: 'username='+ username, cache: false, success: function(response){ if(response == 1){ $('#username').css('border', '3px #C33 solid'); $('#tick').hide(); $('#cross').fadeIn(); }else{ $('#username').css('border', '3px #090 solid'); $('#cross').hide(); $('#tick').fadeIn(); } } }); } } /script /style /head body Username: input name=username id=username type=text / img id=tick src=Sitefiles-N/jquery.formwizard-0.9.8/tick.png width=16 height=16/ img id=cross src=Sitefiles-N/jquery.formwizard-0.9.8/cross.png width=16 height=16/ /body /html The file is posted here: http://www.factoringcompare.com/test1.asp The server side code: http://www.factoringcompare.com/check10.asp html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body 1 /body /html If I am following the code correctly by putting a 1 on check10.asp the script should return that the username is taken. Which it is not On Sep 28, 9:05 pm, MorningZ morni...@gmail.com wrote: Why do you have a page with a php extension? As for helping further, it would be a huge help if you post some non- working code... you could have a bad selector, bad syntax, who knows... On Sep 28, 3:15 pm, factoringcompare firstfacto...@googlemail.com wrote: I can’t get it to work. Something strange is happening. To manually check if the client side code is working I put “1” in the server side page with a .php extension and sure enough I can get the code to work. If I do the same with a .asppage it has no effect. Any thoughts what’s going on? On Sep 28, 7:36 pm, MorningZ morni...@gmail.com wrote: This is the php code I can't mimic: Really? the code is super simple: - Open connection to the database - Take the posted value of username, trim it, and make lower case - Clean up the string to help prevent SQL injection attack - Take that username and check against the database - echo (Response.Write) the number of rows found - Close the database connection On Sep 28, 1:26 pm, factoringcompare firstfacto...@googlemail.com wrote: OK, I am trying to get this example to work :http://papermashup.com/jquery-php-mysql-username-availability-checker/ This is the php code I can't mimic: ?php include(dbConnector.php); $connector = new DbConnector(); $username = trim(strtolower($_POST['username'])); $username = mysql_escape_string($username); $query = SELECT username FROM usernameCheck WHERE username = '$username' LIMIT 1; $result = $connector-query($query); $num = mysql_num_rows($result); echo $num; mysql_close(); On Sep 28, 2:16 pm, MorningZ morni...@gmail.com wrote: Take an example page in php that you want to mimic, and simply have aspsend back to the browser the same information On Sep 28, 3:58 am, factoringcompare firstfacto...@googlemail.com wrote: Hi, Reasonably new to web building. I am now just updating my site with jQuery (first time user). I would like to implement an Ajax username checker on a new client registration form. All the tutorials and examples I can find use jQuery and php. Unfortunately, I have taught myself Access andASPand have no knowledge of php. At this stage I want to stick withASPand Access and look to upgrade the DB as another project. Can any body point me in the right direction to obtain some code. Kind regards.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: IE and DOM issues
I didn't look through the code in detail, but have you considered using the latest version of jQuery library (v1.3.2)? On Sep 28, 10:22 am, Yazan yfahm...@gmail.com wrote: Hi all, I've been wrangling with trying to get my jquery-powered global nav to work consistently in IE8 (in Compatibility Mode) and IE6 and 7, but with no luck. You can view the site here: http://67.23.44.204/ The top nav (Products, Inspirations, etc. should each have a set of subnavs that show up when you hover over them with mouse) works sometimes, and other times not. I recognize that the issue is with all the code that appears in my $(document).ready(fn) statements, and I've tried moving the relevant statement to the bottom of the body section, but still to no avail. It seems to work when I execute the code with window.onload, but I'm trying to avoid using that. Does anyone have any suggestions on how to get IE6, 7 and 8 in Compatibility Mode to execute the jquery code correctly (i.e. after the DOM is loaded)? Any guidance would be much appreciated. thanks, Yazan
[jQuery] Re: show()ing thousands of divs
Mike, the requirement here isn't just to show or hide all 3000 entries in one fell swoop. Sid needs to be able to show and hide individual entries depending on a filter. So there's no avoiding looping through all the entries, whether in JavaScript or on the server. Sid, assuming you want to do this on the client, I think you're on the right track with building an HTML string and using innerHTML. You should be able to get acceptable (1s) performance with 3000 items even in IE7/8. (But is the number of items going to be greater in the future?) If you'd like to post the code for your inner loop that generates the HTML, I'll bet we can find a trick or two to optimize it. Also, take a look at some related code I posted herehttp://groups.google.com/group/jquery-en/browse_thread/thread/051996d22119293c/121203c4216c34ee?show_docid=121203c4216c34eefor some optimization tips. One thing I would possibly do in your case that's different from that code I posted: Since you're inserting a clearing div after each two entries, you may want to unroll the inner loop by 2X, so that each time through the loop you generate *two* of your entries plus the clearing div. Then take care of the possible extra entry outside the loop. I would try it both ways and benchmark it particularly in IE since that's the slowest browser for JavaScript. Raymond and William mentioned using Ajax and doing the filtering on your server. That's certainly worth considering too. -Mike On Mon, Sep 28, 2009 at 11:09 AM, Mike McNally emmecin...@gmail.com wrote: @Mike M. You're still looping through 3000 jQuery objects and invoking the setClass() method. I haven't tried it but I suspected it will take roughly the same time as the show() method. It does seem logical that the actual showing of the div will be faster if the browser does it natively. The question which part is the bottleneck - looping through 3000 jQuery objects or actually show()ing them one by one? If I can experiment and find out, I will - and I'll post the results. No, you're not. You completely misunderstood. You're calling setClass on the single container, not each contained div. -- Turtle, turtle, on the ground, Pink and shiny, turn around.
[jQuery] Re: show()ing thousands of divs
On Mon, Sep 28, 2009 at 3:34 PM, Michael Geary m...@mg.to wrote: Mike, the requirement here isn't just to show or hide all 3000 entries in one fell swoop. Sid needs to be able to show and hide individual entries depending on a filter. So there's no avoiding looping through all the entries, whether in JavaScript or on the server. Well in that case the alternative solution I described could be tried. Instead of iterating through the entities calling show() and hide(), iterate and build (carefully) a CSS block that includes CSS statements for each entity, giving it a style of either { display: block; } or {display: hidden; }. When the CSS is built, drop it into a waiting style element on the page. -- Turtle, turtle, on the ground, Pink and shiny, turn around.
[jQuery] Re: IE and DOM issues
Yes, I have actually :) Are you suggesting that would fix the issue? I haven't looked closely at what 1.3.2 offers over 1.2.6, but I didn't think that that would necessarily fix the issue. I think there might be some dependencies on 1.2.6 in other libraries we're using, so I'm not sure it would be a simple switch, but I can try it if it would fix my issue. thanks, Yazan On Sep 28, 4:34 pm, James james.gp@gmail.com wrote: I didn't look through the code in detail, but have you considered using the latest version of jQuery library (v1.3.2)? On Sep 28, 10:22 am, Yazan yfahm...@gmail.com wrote: Hi all, I've been wrangling with trying to get my jquery-powered global nav to work consistently in IE8 (in Compatibility Mode) and IE6 and 7, but with no luck. You can view the site here: http://67.23.44.204/ The top nav (Products, Inspirations, etc. should each have a set of subnavs that show up when you hover over them with mouse) works sometimes, and other times not. I recognize that the issue is with all the code that appears in my $(document).ready(fn) statements, and I've tried moving the relevant statement to the bottom of the body section, but still to no avail. It seems to work when I execute the code with window.onload, but I'm trying to avoid using that. Does anyone have any suggestions on how to get IE6, 7 and 8 in Compatibility Mode to execute the jquery code correctly (i.e. after the DOM is loaded)? Any guidance would be much appreciated. thanks, Yazan
[jQuery] Apply CSS to dynamic content after it loads
Hi! I've got a page that loads dynamic content, sometimes including links. The CSS seems to apply to the loaded CSS, except for a rule that adds an offsite icon to the end of the link. I've used Firefind to verify the css selector in the css, and it applies to the correct elements, but the icon doesn't show up. Is there anything I need to do after loading the dynamic content to apply the css? Sloan
[jQuery] Re: Apply CSS to dynamic content after it loads
you can chain on an .addClass('myClassName') ? On Mon, Sep 28, 2009 at 3:09 PM, Sloan Thrasher sl...@sloanthrasher.comwrote: Hi! I've got a page that loads dynamic content, sometimes including links. The CSS seems to apply to the loaded CSS, except for a rule that adds an offsite icon to the end of the link. I've used Firefind to verify the css selector in the css, and it applies to the correct elements, but the icon doesn't show up. Is there anything I need to do after loading the dynamic content to apply the css? Sloan -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: Ajax check username - ASP and Access DB
When you return response in your AJAX, it's not 1. It's htmlhead.../html. jQuery doesn't automatically go through your HTML and look in the body to find the 1. In your server-side code, you don't return the whole HTML page. You just return the String 1 (without the quotes). Such that if you load up check10.asp, and view its source, all you see is a 1. That's it. In your AJAX response conditional check, you want to do if (response == 1) (with the double-quotes) Otherwise, you're checking for an integer. What's returned is a String type. On Sep 28, 10:31 am, factoringcompare firstfacto...@googlemail.com wrote: OK, thank you for taking the time out to look at this issue for me. Ok this is the code client side page: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / titleAjax Username Checker - Using JQuery/title style #username{ padding:3px; font-size:18px; border:3px #CCC solid; } #tick{display:none} #cross{display:none} /style script type=text/javascript src=Sitefiles-N/ jquery.formwizard-0.9.8/./jquery-1.3.2.js/script script $(document).ready(function(){ $('#username').keyup(username_check); }); function username_check(){ var username = $('#username').val(); if(username == || username.length 4){ $('#username').css('border', '3px #CCC solid'); $('#tick').hide(); }else{ jQuery.ajax({ type: POST, url: check10.asp, data: 'username='+ username, cache: false, success: function(response){ if(response == 1){ $('#username').css('border', '3px #C33 solid'); $('#tick').hide(); $('#cross').fadeIn(); }else{ $('#username').css('border', '3px #090 solid'); $('#cross').hide(); $('#tick').fadeIn(); } } }); } } /script /style /head body Username: input name=username id=username type=text / img id=tick src=Sitefiles-N/jquery.formwizard-0.9.8/tick.png width=16 height=16/ img id=cross src=Sitefiles-N/jquery.formwizard-0.9.8/cross.png width=16 height=16/ /body /html The file is posted here:http://www.factoringcompare.com/test1.asp The server side code:http://www.factoringcompare.com/check10.asp html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body 1 /body /html If I am following the code correctly by putting a 1 on check10.asp the script should return that the username is taken. Which it is not On Sep 28, 9:05 pm, MorningZ morni...@gmail.com wrote: Why do you have a page with a php extension? As for helping further, it would be a huge help if you post some non- working code... you could have a bad selector, bad syntax, who knows... On Sep 28, 3:15 pm, factoringcompare firstfacto...@googlemail.com wrote: I can’t get it to work. Something strange is happening. To manually check if the client side code is working I put “1” in the server side page with a .php extension and sure enough I can get the code to work. If I do the same with a .asppage it has no effect. Any thoughts what’s going on? On Sep 28, 7:36 pm, MorningZ morni...@gmail.com wrote: This is the php code I can't mimic: Really? the code is super simple: - Open connection to the database - Take the posted value of username, trim it, and make lower case - Clean up the string to help prevent SQL injection attack - Take that username and check against the database - echo (Response.Write) the number of rows found - Close the database connection On Sep 28, 1:26 pm, factoringcompare firstfacto...@googlemail.com wrote: OK, I am trying to get this example to work :http://papermashup.com/jquery-php-mysql-username-availability-checker/ This is the php code I can't mimic: ?php include(dbConnector.php); $connector = new DbConnector(); $username = trim(strtolower($_POST['username'])); $username = mysql_escape_string($username); $query = SELECT username FROM usernameCheck WHERE username = '$username' LIMIT 1; $result = $connector-query($query); $num = mysql_num_rows($result); echo $num; mysql_close(); On Sep 28, 2:16 pm, MorningZ morni...@gmail.com wrote: Take an example page in php that you want to mimic, and simply have aspsend back to the browser the same information On Sep 28, 3:58 am, factoringcompare firstfacto...@googlemail.com wrote: Hi, Reasonably new to web building. I am now just updating my site with jQuery (first time user). I would like to implement an Ajax username checker on a new client registration form. All the tutorials and examples I can find use jQuery and php. Unfortunately, I
[jQuery] Re: IE and DOM issues
I'm not suggesting that would fix the issue, but most of the time using the latest version of the code will get you better results. However if you have dependencies on the old library that you can't change (as there are no updates to those other plug-ins), then I guess we'll have to delve into the code. On Sep 28, 10:41 am, Yazan yfahm...@gmail.com wrote: Yes, I have actually :) Are you suggesting that would fix the issue? I haven't looked closely at what 1.3.2 offers over 1.2.6, but I didn't think that that would necessarily fix the issue. I think there might be some dependencies on 1.2.6 in other libraries we're using, so I'm not sure it would be a simple switch, but I can try it if it would fix my issue. thanks, Yazan On Sep 28, 4:34 pm, James james.gp@gmail.com wrote: I didn't look through the code in detail, but have you considered using the latest version of jQuery library (v1.3.2)? On Sep 28, 10:22 am, Yazan yfahm...@gmail.com wrote: Hi all, I've been wrangling with trying to get my jquery-powered global nav to work consistently in IE8 (in Compatibility Mode) and IE6 and 7, but with no luck. You can view the site here: http://67.23.44.204/ The top nav (Products, Inspirations, etc. should each have a set of subnavs that show up when you hover over them with mouse) works sometimes, and other times not. I recognize that the issue is with all the code that appears in my $(document).ready(fn) statements, and I've tried moving the relevant statement to the bottom of the body section, but still to no avail. It seems to work when I execute the code with window.onload, but I'm trying to avoid using that. Does anyone have any suggestions on how to get IE6, 7 and 8 in Compatibility Mode to execute the jquery code correctly (i.e. after the DOM is loaded)? Any guidance would be much appreciated. thanks, Yazan
[jQuery] Re: (jQuery validate) Remote Custom Message Problem on version 1.5.5
Could you provide some code on how you're setting the error message ... already exists? On Sep 28, 7:49 am, Thiago Miranda de Oliveira thiago...@gmail.com wrote: Hi.. I´ve upgraded my validate plugin to the 1.5.5 and I was having a problem: I have an email that needs to be checked if it already exists by ajax, and I was using the Validate Remote Method. In my old Validate version ( 1.5) it works great, but in the 1.5.5 version when I validate the email field it show primary the correct error message ( if it exists): Email n...@nono.com already exists. But if I type another existing email, no matter which one, I get the same message with the same email using the validator.format Email n...@nono.com already exists. I was debugging the code and I´ve found out that in line 932 the 1.5 version was written like that: errors[element.name] = response || validator.defaultMessage( element, remote ); And in the 1.5.5 like that: errors[element.name] = previous.message = response || validator.defaultMessage( element, remote ); So I removed the previous.message and it worked great. Does anyone knows why they added this previous.message to this line? And what exactly it does? Thanks
[jQuery] Re: Ajax check username - ASP and Access DB
Thank you James that worked. I can now move on and try and code the DB connection. On Sep 28, 10:22 pm, James james.gp@gmail.com wrote: When you return response in your AJAX, it's not 1. It's htmlhead.../html. jQuery doesn't automatically go through your HTML and look in the body to find the 1. In your server-side code, you don't return the whole HTML page. You just return the String 1 (without the quotes). Such that if you load up check10.asp, and view its source, all you see is a 1. That's it. In your AJAX response conditional check, you want to do if (response == 1) (with the double-quotes) Otherwise, you're checking for an integer. What's returned is a String type. On Sep 28, 10:31 am, factoringcompare firstfacto...@googlemail.com wrote: OK, thank you for taking the time out to look at this issue for me. Ok this is the code client side page: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / titleAjax Username Checker - Using JQuery/title style #username{ padding:3px; font-size:18px; border:3px #CCC solid; } #tick{display:none} #cross{display:none} /style script type=text/javascript src=Sitefiles-N/ jquery.formwizard-0.9.8/./jquery-1.3.2.js/script script $(document).ready(function(){ $('#username').keyup(username_check); }); function username_check(){ var username = $('#username').val(); if(username == || username.length 4){ $('#username').css('border', '3px #CCC solid'); $('#tick').hide(); }else{ jQuery.ajax({ type: POST, url: check10.asp, data: 'username='+ username, cache: false, success: function(response){ if(response == 1){ $('#username').css('border', '3px #C33 solid'); $('#tick').hide(); $('#cross').fadeIn(); }else{ $('#username').css('border', '3px #090 solid'); $('#cross').hide(); $('#tick').fadeIn(); } } }); } } /script /style /head body Username: input name=username id=username type=text / img id=tick src=Sitefiles-N/jquery.formwizard-0.9.8/tick.png width=16 height=16/ img id=cross src=Sitefiles-N/jquery.formwizard-0.9.8/cross.png width=16 height=16/ /body /html The file is posted here:http://www.factoringcompare.com/test1.asp The server side code:http://www.factoringcompare.com/check10.asp html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body 1 /body /html If I am following the code correctly by putting a 1 on check10.asp the script should return that the username is taken. Which it is not On Sep 28, 9:05 pm, MorningZ morni...@gmail.com wrote: Why do you have a page with a php extension? As for helping further, it would be a huge help if you post some non- working code... you could have a bad selector, bad syntax, who knows... On Sep 28, 3:15 pm, factoringcompare firstfacto...@googlemail.com wrote: I can’t get it to work. Something strange is happening. To manually check if the client side code is working I put “1” in the server side page with a .php extension and sure enough I can get the code to work. If I do the same with a .asppage it has no effect. Any thoughts what’s going on? On Sep 28, 7:36 pm, MorningZ morni...@gmail.com wrote: This is the php code I can't mimic: Really? the code is super simple: - Open connection to the database - Take the posted value of username, trim it, and make lower case - Clean up the string to help prevent SQL injection attack - Take that username and check against the database - echo (Response.Write) the number of rows found - Close the database connection On Sep 28, 1:26 pm, factoringcompare firstfacto...@googlemail.com wrote: OK, I am trying to get this example to work :http://papermashup.com/jquery-php-mysql-username-availability-checker/ This is the php code I can't mimic: ?php include(dbConnector.php); $connector = new DbConnector(); $username = trim(strtolower($_POST['username'])); $username = mysql_escape_string($username); $query = SELECT username FROM usernameCheck WHERE username = '$username' LIMIT 1; $result = $connector-query($query); $num = mysql_num_rows($result); echo $num; mysql_close(); On Sep 28, 2:16 pm, MorningZ morni...@gmail.com wrote: Take an example page in php that you want to mimic, and simply have aspsend back to the browser the same information On Sep 28, 3:58 am, factoringcompare firstfacto...@googlemail.com wrote: Hi,
[jQuery] Re: IE and DOM issues
FYI, I did a quick test using 1.3.2, and while it didn't seem to break anything, it didn't fix the issue either. We'll have to do some regression tests if we upgrade our jquery version, so for the time being we'll stick with 1.2.6. Any suggestions for fixing this issue besides using window.onload? I'm not even certain using window.onload would fix the issue without breaking something else... thanks in advance, yazan On Sep 28, 5:27 pm, James james.gp@gmail.com wrote: I'm not suggesting that would fix the issue, but most of the time using the latest version of the code will get you better results. However if you have dependencies on the old library that you can't change (as there are no updates to those other plug-ins), then I guess we'll have to delve into the code. On Sep 28, 10:41 am, Yazan yfahm...@gmail.com wrote: Yes, I have actually :) Are you suggesting that would fix the issue? I haven't looked closely at what 1.3.2 offers over 1.2.6, but I didn't think that that would necessarily fix the issue. I think there might be some dependencies on 1.2.6 in other libraries we're using, so I'm not sure it would be a simple switch, but I can try it if it would fix my issue. thanks, Yazan On Sep 28, 4:34 pm, James james.gp@gmail.com wrote: I didn't look through the code in detail, but have you considered using the latest version of jQuery library (v1.3.2)? On Sep 28, 10:22 am, Yazan yfahm...@gmail.com wrote: Hi all, I've been wrangling with trying to get my jquery-powered global nav to work consistently in IE8 (in Compatibility Mode) and IE6 and 7, but with no luck. You can view the site here: http://67.23.44.204/ The top nav (Products, Inspirations, etc. should each have a set of subnavs that show up when you hover over them with mouse) works sometimes, and other times not. I recognize that the issue is with all the code that appears in my $(document).ready(fn) statements, and I've tried moving the relevant statement to the bottom of the body section, but still to no avail. It seems to work when I execute the code with window.onload, but I'm trying to avoid using that. Does anyone have any suggestions on how to get IE6, 7 and 8 in Compatibility Mode to execute the jquery code correctly (i.e. after the DOM is loaded)? Any guidance would be much appreciated. thanks, Yazan
[jQuery] Any one knows equivalent non php plugin for this?
http://www.frontpageslideshow.net/ Anyone knows equivalent plugin which I can use in python/django site. This plugin is php specific
[jQuery] Re: (jQuery validate) Remote Custom Message Problem on version 1.5.5
I've done a quick test on it on 1.5.5 and I'm experiencing the duplicate message issue also using the following message options: remote: function() { // $(#email) is the input field for the email address return $(#email).val()+' already exists'; } remote: function(email) { return $.validator.format('{0} already exists', email); } Both returns the first error message despite changing the value of the input to another invalid email input. Can anyone verify if this is the correct way to go about it? On Sep 28, 11:34 am, James james.gp@gmail.com wrote: Could you provide some code on how you're setting the error message ... already exists? On Sep 28, 7:49 am, Thiago Miranda de Oliveira thiago...@gmail.com wrote: Hi.. I´ve upgraded my validate plugin to the 1.5.5 and I was having a problem: I have an email that needs to be checked if it already exists by ajax, and I was using the Validate Remote Method. In my old Validate version ( 1.5) it works great, but in the 1.5.5 version when I validate the email field it show primary the correct error message ( if it exists): Email n...@nono.com already exists. But if I type another existing email, no matter which one, I get the same message with the same email using the validator.format Email n...@nono.com already exists. I was debugging the code and I´ve found out that in line 932 the 1.5 version was written like that: errors[element.name] = response || validator.defaultMessage( element, remote ); And in the 1.5.5 like that: errors[element.name] = previous.message = response || validator.defaultMessage( element, remote ); So I removed the previous.message and it worked great. Does anyone knows why they added this previous.message to this line? And what exactly it does? Thanks
[jQuery] Re: Ajax check username - ASP and Access DB
OK, now got the backend working with the following code: %...@language=VBSCRIPT% !--#include file=Connections/car.asp -- % Dim rsUser__MMColParam rsUser__MMColParam = 1 If (Request.Form(username) ) Then rsUser__MMColParam = Request.Form(username) End If % % Dim rsUser Dim rsUser_numRows Set rsUser = Server.CreateObject(ADODB.Recordset) rsUser.ActiveConnection = MM_car_STRING rsUser.Source = SELECT UserName FROM Users WHERE UserName = ' + Replace(rsUser__MMColParam, ', '') + ' rsUser.CursorType = 0 rsUser.CursorLocation = 2 rsUser.LockType = 1 rsUser.Open() rsUser_numRows = 0 % % If Not rsUser.EOF Or Not rsUser.BOF Then % 1 % End If ' end Not rsUser.EOF Or NOT rsUser.BOF % % rsUser.Close() Set rsUser = Nothing % On Sep 28, 10:40 pm, factoringcompare firstfacto...@googlemail.com wrote: Thank you James that worked. I can now move on and try and code the DB connection. On Sep 28, 10:22 pm, James james.gp@gmail.com wrote: When you return response in your AJAX, it's not 1. It's htmlhead.../html. jQuery doesn't automatically go through your HTML and look in the body to find the 1. In your server-side code, you don't return the whole HTML page. You just return the String 1 (without the quotes). Such that if you load up check10.asp, and view its source, all you see is a 1. That's it. In your AJAX response conditional check, you want to do if (response == 1) (with the double-quotes) Otherwise, you're checking for an integer. What's returned is a String type. On Sep 28, 10:31 am, factoringcompare firstfacto...@googlemail.com wrote: OK, thank you for taking the time out to look at this issue for me. Ok this is the code client side page: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / titleAjax Username Checker - Using JQuery/title style #username{ padding:3px; font-size:18px; border:3px #CCC solid; } #tick{display:none} #cross{display:none} /style script type=text/javascript src=Sitefiles-N/ jquery.formwizard-0.9.8/./jquery-1.3.2.js/script script $(document).ready(function(){ $('#username').keyup(username_check); }); function username_check(){ var username = $('#username').val(); if(username == || username.length 4){ $('#username').css('border', '3px #CCC solid'); $('#tick').hide(); }else{ jQuery.ajax({ type: POST, url: check10.asp, data: 'username='+ username, cache: false, success: function(response){ if(response == 1){ $('#username').css('border', '3px #C33 solid'); $('#tick').hide(); $('#cross').fadeIn(); }else{ $('#username').css('border', '3px #090 solid'); $('#cross').hide(); $('#tick').fadeIn(); } } }); } } /script /style /head body Username: input name=username id=username type=text / img id=tick src=Sitefiles-N/jquery.formwizard-0.9.8/tick.png width=16 height=16/ img id=cross src=Sitefiles-N/jquery.formwizard-0.9.8/cross.png width=16 height=16/ /body /html The file is posted here:http://www.factoringcompare.com/test1.asp The server side code:http://www.factoringcompare.com/check10.asp html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body 1 /body /html If I am following the code correctly by putting a 1 on check10.asp the script should return that the username is taken. Which it is not On Sep 28, 9:05 pm, MorningZ morni...@gmail.com wrote: Why do you have a page with a php extension? As for helping further, it would be a huge help if you post some non- working code... you could have a bad selector, bad syntax, who knows... On Sep 28, 3:15 pm, factoringcompare firstfacto...@googlemail.com wrote: I can’t get it to work. Something strange is happening. To manually check if the client side code is working I put “1” in the server side page with a .php extension and sure enough I can get the code to work. If I do the same with a .asppage it has no effect. Any thoughts what’s going on? On Sep 28, 7:36 pm, MorningZ morni...@gmail.com wrote: This is the php code I can't mimic: Really? the code is super simple: - Open connection to the database - Take the posted value of username, trim it, and make lower case - Clean up the string to help prevent SQL injection attack - Take that username and check against the database - echo (Response.Write) the number of rows found - Close the database connection On Sep 28, 1:26 pm, factoringcompare
[jQuery] Re: how to submit a form after validation please ?
I don't understand what you are replying to. I have an alert inside the submitHandler, How do I get POST to my form to happen after it is validated. That IS NOT happening. Thanks . On Sep 28, 3:58 pm, Leonardo K leo...@gmail.com wrote: Just a tip: You don't need to create a new validator function for your select. Instead of using value=none for your default option use value= and just add required:true to the rules. about your problem: Try to put the alert inside the submitHandler function to know if your form is validating. On Mon, Sep 28, 2009 at 15:53, slimshady bringmewa...@gmail.com wrote: Can anyone tell me why my form action on line 113 does not fire after I get successful validation ? http://gist.github.com/195643 After the form validates I want it to POST submit to the url please.
[jQuery] huge newb question
Hello all, I'm trying to run through the simplest tutorials on jquery and for some reason I can't get any of the jquery code to work. I've downloaded jquery and I've made sure that this file is in the same directory as jquery-1.3.2.js. This is the code taken from the tutorial: html head meta http-equiv=Content-Type content=text/html; charset=utf-8 script src=jquery-1.3.2.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(a).click(function(event){ alert(As you can see, the link no longer took you to jquery.com); event.preventDefault(); }); }); /script /head body a href=http://jquery.com/;jQuery/a /body /html when the user clicks on the link it shouldn't take them to jquery.com, instead it should display an alert box. but it takes me to jquery.com every time. Thanks.
[jQuery] Modal Dialog with a datepicker inside, works one time, then never...
Hi everybody. Let me introduce myself. I'm a developer located in Venezuela (latin america), and i have like 2 years using Jquery in every project that came to my hands. Its a pleasure to meet you all. For begin, i have a little problem that i hope you can giveme some light here: I have created a modal dialog inside a tab with a simple form that has a datepicker: div id=tabs-3 style=font-size:11px; div style=padding-left:75%; a href=javascript:void(0) onClick=javascript:{modalForm ('idValuation','destiny.php',$(this).text());} Add Valuation /a /div div id=idValuation style=display:none;padding:2px table tr td valign=topComments: /td tdtextarea type=text name=comment_omit style=width:200px;/textarea/td /tr tr tdDate: /td td script type=text/javascript dateSelector('idFIV'); /script input type=text name=date id=idFIV readonly=true size=10 class=calendario style=border:none /td /tr /table /div /div So, as you can see i call a function dateSelector and this function calls the datePicker like this: function dateSelector(id) { $(document).ready(function() { $(#+id).css({'border':'none','background- color':'#E5E5E5','float':'left'}); $(#+id).datepicker( { showOn: 'button', buttonImage: 'images/iconos/calendar.png', dateFormat:'dd-mm-yy', buttonImageOnly: true }, $.datepicker.regional['es']); }); } The dialog its created like this: function modalForm(id, url, tittle) { if ( !$(#+id).dialog( 'isOpen' ) ){ $(#+id).dialog({ bgiframe : true, closeOnEscape : true, resizable : false, width : 500, modal : true, title : tittle, beforeclose: function(event, ui) { $(this).dialog('destroy'); }, buttons : { 'Cancel' : function() { $(this).dialog('close'); }, 'Add Record' : function() { updateView(''+url+'',''+id+''); $(this).dialog('close'); } } }); $(#+id).dialog('open'); } } This works just perfect, the dialog appear, i can select the date, add a record to the database, and then just call again the dialog using the link. The thing is that when i use this the first time, works perfect, when i try to add a second record, the date picker doesnt refresh the field. It shows the calendar, but when i select a value, this doesnt appear in the input, and even more strange, if i close de dialog and then reopen, it appears the value that i tried to select, selected, but the same problem again. What i am doing wrong with this ? Why works only the first time and then breaks? Thanks in advance for all your help! :-D
[jQuery] Re: huge newb question
Try using: return false; Instead of: event.preventDefault(); On Sep 28, 11:21 am, Pitchwife dandau...@gmail.com wrote: Hello all, I'm trying to run through the simplest tutorials on jquery and for some reason I can't get any of the jquery code to work. I've downloaded jquery and I've made sure that this file is in the same directory as jquery-1.3.2.js. This is the code taken from the tutorial: html head meta http-equiv=Content-Type content=text/html; charset=utf-8 script src=jquery-1.3.2.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(a).click(function(event){ alert(As you can see, the link no longer took you to jquery.com); event.preventDefault(); }); }); /script /head body a href=http://jquery.com/;jQuery/a /body /html when the user clicks on the link it shouldn't take them to jquery.com, instead it should display an alert box. but it takes me to jquery.com every time. Thanks.
[jQuery] Re: huge newb question
Try a return false instead of event.preventDefault() Liam Pitchwife wrote: Hello all, I'm trying to run through the simplest tutorials on jquery and for some reason I can't get any of the jquery code to work. I've downloaded jquery and I've made sure that this file is in the same directory as jquery-1.3.2.js. This is the code taken from the tutorial: html head meta http-equiv=Content-Type content=text/html; charset=utf-8 script src=jquery-1.3.2.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(a).click(function(event){ alert(As you can see, the link no longer took you to jquery.com); event.preventDefault(); }); }); /script /head body a href=http://jquery.com/;jQuery/a /body /html when the user clicks on the link it shouldn't take them to jquery.com, instead it should display an alert box. but it takes me to jquery.com every time. Thanks. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.113/2400 - Release Date: 09/28/09 05:51:00
[jQuery] (Bassistance validate) Require inputs based on dropdown select
Info: - jquery-1.3.2 - jquery.validate-1.5.5 - form with 1 dropdown select and 4 text inputs Setup: - all 4 text fields are not initially required. Issue: The first input element is a required dropdown select. If the user selects option 1, then text field 1 2 need to be required. If the user selects option 2, then text field 3 4 need to be required. How do code this? Thanks in advance! Also, I tried searching the groups first but couldn't find anything that either worked are was close enough for me to tweak.
[jQuery] Re: (Bassistance validate) Require inputs based on dropdown select
Sorry, here's a fix of the rules ('input' is suppose to be 'select') (these are untested): options = { rules: { mySelect: { required:true }, myfield1: { required: function() { return ($(select[name=mySelect]).val() == '1'); } }, myfield2: { required: function() { return ($(select[name=mySelect]).val() == '1'); } }, myfield3: { required: function() { return ($(select[name=mySelect]).val() == '2'); } }, myfield4: { required: function() { return ($(select[name=mySelect]).val() == '2'); } } } } On Sep 28, 2:20 pm, James james.gp@gmail.com wrote: Suppose your fields look like this: select name=mySelect option value=1Option 1/option option value=2Option 2/option /select input type=text name=myField1 / input type=text name=myField2 / input type=text name=myField3 / input type=text name=myField4 / Your validation rules would look something like this: options = { rules: { mySelect: { required:true }, myfield1: { required: function() { return ($(input[name=mySelect]).val() == '1'); } }, myfield2: { required: function() { return ($(input[name=mySelect]).val() == '1'); } }, myfield3: { required: function() { return ($(input[name=mySelect]).val() == '2'); } }, myfield4: { required: function() { return ($(input[name=mySelect]).val() == '2'); } }, } } On Sep 28, 2:10 pm, Andrew andrewgtibbe...@gmail.com wrote: Info: - jquery-1.3.2 - jquery.validate-1.5.5 - form with 1 dropdown select and 4 text inputs Setup: - all 4 text fields are not initially required. Issue: The first input element is a required dropdown select. If the user selects option 1, then text field 1 2 need to be required. If the user selects option 2, then text field 3 4 need to be required. How do code this? Thanks in advance! Also, I tried searching the groups first but couldn't find anything that either worked are was close enough for me to tweak.
[jQuery] Re: validate plugin step by step form
You can create different options in a variable an assign it to $.validate(). var option1 = { rules: { ... } messages: { ... } } var option2 = { rules: { ... } messages: { ... } } Call the appropriate one depending on which step you're in: $(#saverForm).validate(option1); $(#saverForm).validate(option2); On Sep 28, 5:38 am, adexcube alfonsoenci...@gmail.com wrote: Hi, I'm creating a step by step form using jquery ui tabs and validation plugin, the problem is that I've got just one form ( and I have to ) so on first step the form is validated but all errors an others steps are displayed. I'm using an approach ofhttp://jquery.bassistance.de/validate/demo/multipart/ but I've got specific messages and validations. Something like var v=$(#saverForm).validate( { debug: true, focusCleanup : false, rules: { signupDetails.hasUnderstoodDeclaration : required, applicantType: required, title: required,}, messages:{ signupDetails.hasUnderstoodDeclaration : Please accept The terms and conditions, applicantType: Please select an option., title: Please choose your title., firstname: Please enter your first name., lastname: Please enter your surname., }); and a lot more fields. Is there any way I can add rules an messages to the form rather than add them to the fields?? or can I create different form.validate() variables and then call them depending oin which step am I? something like v[0] =$(#saverForm).validate( some set of 2 rules for example ) v[1] =$(#saverForm).validate( some set of 10 rules for example different than above) Many thanks
[jQuery] Re: (Bassistance validate) Require inputs based on dropdown select
Suppose your fields look like this: select name=mySelect option value=1Option 1/option option value=2Option 2/option /select input type=text name=myField1 / input type=text name=myField2 / input type=text name=myField3 / input type=text name=myField4 / Your validation rules would look something like this: options = { rules: { mySelect: { required:true }, myfield1: { required: function() { return ($(input[name=mySelect]).val() == '1'); } }, myfield2: { required: function() { return ($(input[name=mySelect]).val() == '1'); } }, myfield3: { required: function() { return ($(input[name=mySelect]).val() == '2'); } }, myfield4: { required: function() { return ($(input[name=mySelect]).val() == '2'); } }, } } On Sep 28, 2:10 pm, Andrew andrewgtibbe...@gmail.com wrote: Info: - jquery-1.3.2 - jquery.validate-1.5.5 - form with 1 dropdown select and 4 text inputs Setup: - all 4 text fields are not initially required. Issue: The first input element is a required dropdown select. If the user selects option 1, then text field 1 2 need to be required. If the user selects option 2, then text field 3 4 need to be required. How do code this? Thanks in advance! Also, I tried searching the groups first but couldn't find anything that either worked are was close enough for me to tweak.
[jQuery] Re: autocomplete, extraParams and $(this)
extra_var does not map to the ID of the input field. It is the name that is going to be sent along with the AJAX request to your script. (e.g. /autocomplete_lookup/? q=my_search_text_blahablhablahextra_var=12345) You have to change it so it's: 'extra_var': function() { return $(#extra_var).attr('id'); } On Sep 26, 8:39 am, patrickk patr...@vonautomatisch.at wrote: I´m a bit confused, because the following doesn´t seem to work and I have no idea why ... after searching google for a couple of hours and trying different solutions, I´m posting this here and hope that someone can help. $(input.vAutocompleteField).autocomplete('/ autocomplete_lookup/', { highlight: false, mustMatch: false, matchContains: true, cacheLength: 20, minChars: 2, extraParams: { 'extra_var': function() { return $(this).attr('id'); } } }); extra_var should be the ID of the current input-field. this is probably just me don´t seeing what´s wrong ... so any help is appreciated. thanks, patrick
[jQuery] Re: autocomplete, extraParams and $(this)
By the way, 'extra_var': function() { return $(#extra_var).attr('id'); } Would return extra_var since $(#extra_var).attr('id'); is extra_var. I'm not sure what you're trying to achieve if that's not what you want. On Sep 28, 2:34 pm, James james.gp@gmail.com wrote: extra_var does not map to the ID of the input field. It is the name that is going to be sent along with the AJAX request to your script. (e.g. /autocomplete_lookup/? q=my_search_text_blahablhablahextra_var=12345) You have to change it so it's: 'extra_var': function() { return $(#extra_var).attr('id'); } On Sep 26, 8:39 am, patrickk patr...@vonautomatisch.at wrote: I´m a bit confused, because the following doesn´t seem to work and I have no idea why ... after searching google for a couple of hours and trying different solutions, I´m posting this here and hope that someone can help. $(input.vAutocompleteField).autocomplete('/ autocomplete_lookup/', { highlight: false, mustMatch: false, matchContains: true, cacheLength: 20, minChars: 2, extraParams: { 'extra_var': function() { return $(this).attr('id'); } } }); extra_var should be the ID of the current input-field. this is probably just me don´t seeing what´s wrong ... so any help is appreciated. thanks, patrick
[jQuery] File upload - json result ERRORZ!
There appears to be some sort of bug happening if you do a file upload and try to return a json result. If you submit this page without any file selected in the file input an alertbox will pop up saying: {data:div} however if you select a file in the file input then press submit the alert will show this: {data:div}/div which can't be eval'd correctly as a json object. It looks like the browser is trying to auto-complete the object returned in the iframe or something like that? Testing was done in FF3.5.3 ?php if ( !empty($_POST) ) { echo json_encode(array('data'='div')); exit; } ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title script type=text/javascript src=http://ajax.googleapis.com/ajax/ libs/jquery/1.3/jquery.min.js/script script type=text/javascript src=http://malsup.com/jquery/form/ jquery.form.js?2.33/script script type=text/javascript $(document).ready(function() { $('#frm').ajaxForm({success: function(data) { alert( data ); }}); }); /script /head body form name='frm' id='frm' method='post' action='' enctype=multipart/ form-data pFile: input type='file' name='file' //p input name='btnSubmit' type='submit' value='submit' / /form /body /html
[jQuery] ajax complete function not being called
I'm making a call to a Twitter JSON feed, and when I pass an incorrect username, jQuery's ajax complete method never gets called. An example of a JSON response that causes complete not to be called (nor error, nor success) is: http://twitter.com/users/show.json?screen_name=bhdjbhubeuhfbfbjfbjf Here's my code: $.ajax({ type: GET, url: http://twitter.com/users/show.json;, cache: false, data: screen_name= + $('#account-id').val().replace(/^\s*|\s*$/ g,''), dataType: jsonp, async: true, success: function(j){ alert('success'); }, error: function(xhr, ajaxOptions, thrownError) { alert(xhr + ' ' + ajaxOptions + ' ' + thrownError); }, complete: function() { alert('finished'); } }); Any ideas on why the complete method isn't getting called? Shouldn't this always get called? Thanks!
[jQuery] Re: keepp getting NaN vlue
On Sep 28, 9:21 pm, runrunforest craigco...@gmail.com wrote: Hi, I'm making a calculator for freight customer It seems I'm on the right path. But there is two bugs i need help. The TOTAL TO PAY value always seem to appear as NaN at first instead of default 3. And the function of TOTAL TO PAY only work after checkbox is checkd, I need it work regarding to changing of input value not just checkbox. Consider something like; script type=text/javascript var updater = (function() { var distanceEl, weightEl, wresultEl, priorityEl, presultEl, grandtotalEl; var intRe = /\D/; var firstK = 3; var nextK = 1000; // Get the value of el function getValue(el) { var val = el.value.replace(/ /g,''); return !intRe.test(val)? Number(val) : NaN; } // Return reference to element using id function getEl(id) { return document.getElementById(id); } return { setup: function() { distanceEl = getEl('distance'); dresultEl = getEl('dresult'); weightEl = getEl('weight'); wresultEl = getEl('wresult'); priorityEl = getEl('priority'); presultEl = getEl('presult'); grandtotalEl = getEl('grandtotal'); updateEl = getEl('updateCell'); resetEl = getEl('resetButton'); distanceEl.onchange = updater.run; weightEl.onchange = updater.run; wresultEl.onchange = updater.run; priorityEl.onchange = updater.run; distanceEl.onchange = updater.run; resetEl.onclick = updater.runLate; if (updateEl) { var el = document.createElement('input'); el.type = 'button'; el.value = 'Update total'; el.onclick = updater.run; updateEl.appendChild(el); } updater.run(); }, run: function() { var d = getValue(distanceEl); var w = getValue(weightEl); var dCost = 0; var wCost = 0; var pCost = 0; // Check for errors, don't continue if found if ((!d d != 0) || d 0) { alert('Invalid distance, must be an integer.'); return; } else if ((!w w != 0 ) || w 0) { alert('Invalid weight, must be an integer.'); return; } // Calculate cost for distance if (d 0) { dCost = 3; --d; } dCost += d * 1000; dresultEl.innerHTML = 'USD' + dCost; // Calculate cost if (w 5) { wCost = (w - 5) * 5000; } wresultEl.innerHTML = 'USD' + wCost; // Add extra if priority if (priorityEl.checked) { pCost = 5000; } presultEl.innerHTML = 'USD' + pCost; grandtotalEl.innerHTML = 'USD' + (dCost + wCost + pCost); }, runLate: function() { window.setTimeout(updater.run, 0); } } })(); window.onload = updater.setup; /script form table tr td colspan=4Please enter whole numbers only. tr tdDistance (km) tdinput type=text id=distance value=1 td id=dresult td First km is USD30,000, additional km are USD1,000 each tr tdWeight (kg) tdinput type=text id=weight value=0 td id=wresult tdNo extra fee for goods under 5kg tr tdUrgent? tdinput type=checkbox id=priority td id=presult tdUrgent goods USD5,000 extra tr tdTotal to pay: td td id=grandtotal td tr tdinput id=resetButton type=reset tdinput type=submit td id=updateCell td /table /form -- Rob
[jQuery] Ajax post on save dialog box
Hi, I am loading tiny Mce editor in a dialog box which updates the div on save I am trying to save in database 'Save Comment': function() { var content = tinyMCE.get('editor').getContent(); $.ajax({ type: POST, url: comments.php, data: do=editcommentc=+ cid +pagetext=+ content + }); Alert placed before the ajax call shows that I get the cid and the pagetext Alert placed after the ajax call are also successful. So my problem is the ajax call which is not sending any data. Please someone, what is the best way to post? Thank you. -- View this message in context: http://www.nabble.com/Ajax-post-on-save-dialog-box-tp25656699s27240p25656699.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.