[jQuery] Sorting a list of objects ( not in table)

2009-01-08 Thread Ajay

Hi all,

I have a list of objects that I represent in a search result and I
need following features.. on the search ressult page

pagination.. filtering and sorting on basis of some parameters..
e.g.
http://tinyurl.com/7uldsd

I found lot of plugins for doing all this in tables and representing
sortable values in columns.. but I don't want to do that and want to
represent the results in the list form as in the example URL
Can any one point to some plugin or code using which I can do
this.. ?? Any advice or pointers on how to go about doing this is also
most welcome


Thanks!


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Alexandre Plennevaux

hi Ricardo,  it's actually 120 hours per year, and it's the last two
years. so 240 hours.

On Fri, Jan 9, 2009 at 4:44 AM, Ricardo Tomasi  wrote:
>
> Yes but what happens when you find an error in your script? It might
> be a very basic mistake but you won't have a clue if you don't know
> javascript itself. What happens 5 years from know if a totally
> different library, with different syntax, takes over?
>
> I agree with Peter Higgins, it's much more useful to teach the basics
> first, then introduce jQuery, if they got the very basics then they
> can learn the rest on their own. It's like teaching someone to use the
> Blueprint CSS framework and not explaining what classes really are.
> They`ll find themselves lost at the first adversity.
>
> - ricardo
>
> Do you mean 2 hours a week for 3 years? That's enough to learn well 5
> different languages :D
>
> On Jan 8, 8:30 pm, Kean  wrote:
>> Your audience are designers, they will pick up jQuery faster because
>> they think in CSS.
>>
>> At what point do you teach them javascript?
>> When you teach them how to create plugins for jQuery.
>>
>> I hope this helps.
>>
>> On Jan 8, 2:13 pm, Nikola  wrote:
>>
>> > Why not integrate the basic "JavaScript Fundamentals" in each jQuery
>> > lesson.  You could show some general examples and explain the
>> > rudimentary JavaScript principal (I'm thinking a 15 minute
>> > introduction...) then teach the jQuery and demonstrate how and why
>> > jQuery is the "write less, do more" JavaScript library..  This way,
>> > students get the gist of the JavaScript while learning jQuery. This
>> > may not be as desirable as learning jQuery on top of a strong
>> > JavaScript foundation but it can certainly help them to become
>> > stronger jQuery developers while giving them an introductory
>> > foundation in JavaScript principals.


[jQuery] Re: how to select all first td's inside all in a table

2009-01-08 Thread jQuery Lover

Once more solution:

 $("tr td:nth-child(1)").addClass('date');


jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Fri, Jan 9, 2009 at 2:58 AM, Tijmen Smit  wrote:
>
> I have a table that contains several , all of them look like
> this.
>
>
>20-04
>459
>559
>659
>439
>519
>599
>424
>489
>554
>
>
>27-04
>506
>606
>706
>486
>566
>646
>471
>536
>601
>
>
>
> One of the things that I would like to do is add the class "date" to
> the first td that exists after a .
>
> I came up with this -> $("#prijslijst-appartement tr td:eq
> (0)").addClass("date"); , but that doesn't really do what I thought It
> would. It only adds the date class to one td, and it ignores all the
> other  in the table. What I was hoping it would do is finding all
> , and then add the date class to the first  in all the  in
> the entire table.
>
> You can see the example here -> http://tijmensmit.com/dev/td/prijslijst.html.
> The one with the date class on it has the pink border around it.
>
> Its not only the first  which I should target, the 3th, 6th and
> 9th  within each  should also be given a different class.
>
> What would be the best way to do this, and to make sure it looks in
> all  in the entire table, and not stops after the first one?
>
> Thanks,
> Tijmen


[jQuery] Re: simple problem

2009-01-08 Thread jQuery Lover

You are selecting an image and image has no HTML or any kind of text
content in it!

img element has no html() function.

jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Thu, Jan 8, 2009 at 8:11 PM, CreativeMind  wrote:
>
> hi all,
> i m unable to find the img and its src attribute...
> when i write
> alert($(myobj[1][$c]).find('li').html());
> i get the output
>  
>
>  alert($(myobj[1][$c]).find('li').find('a').html());
> 
>
> but when i try
>  alert($(myobj[1][$c]).find('li').find('a').find('img').html());
>
> i get no value or empty value .. can u plz correct it..
> thx
>


[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread jQuery Lover

Here is how to simulate a backspace in javascript:

  getElementById('yourTextBox').Select(TextBox1.SelectionStart - 1, 1)
  getElementById('yourTextBox').SelectedText = "


jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Fri, Jan 9, 2009 at 11:03 AM, RSol  wrote:
>
> To replace ':)' to image I see 2 variants:
> When I detect ':)' I:
> 1. Emulate two BackSpace and execCommand('InsertImage',false,img)
> 2. Get all text from '#editor', then String.replace(/:\)/g,img), then
> put that in '#editor', then need moove cursor to the end of '#editor'.
> I dont know how to move cursor to the end of editor.
>
> I select 1st variant, and try emulate BackSpace key. Using $
> ('#editor').trigger("keypress", ) I cant do this - I dont ckow
> how!
> I find:
>
> var evt = document.createEvent("KeyEvents");
> evt.initKeyEvent(
>  "keypress",//  in DOMString typeArg,
>  true, //  in boolean canBubbleArg,
>  true, //  in boolean cancelableArg,
>  null, //  in nsIDOMAbstractView viewArg,  Specifies
> UIEvent.view. This value may be null.
>  false,//  in boolean ctrlKeyArg,
>  false,//  in boolean altKeyArg,
>  false,//  in boolean shiftKeyArg,
>  false,//  in boolean metaKeyArg,
>  8,   //  in unsigned long keyCodeArg,
>  0);  //  in unsigned long charCodeArg);
> $('#editor')[0].dispatchEvent(evt);
>
> it's work in FF, but dont work in IE.
>
>> Ah, I think I see the issue. Am I right in assuming that you don't
>> want to simulate the backspace, but detect it?
>
> I need to simulate the BackSpace
>
>> Also, how are you keeping track of the replacement? It seems to me
>> that you could do yourself a big favor and make what the user enters
>> not what you show the user, so when they delete a smiley, you can just
>> remove the whole thing?


[jQuery] Re: jQuery - Binding to Ajax Event

2009-01-08 Thread jQuery Lover

Why don't you use jQuery's helper function $.getJSON( url, [data], [callback] )

http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback


jQuery HowTo Resource  -  http://jquery-howto.blogspot.com


On Fri, Jan 9, 2009 at 9:32 AM, goodsanket  wrote:
>
> Hi all
>
> I am developing a portal and i am kind of stuck.
> I am using multiple AJAX calls to get data dynamically from a JSON
> file.
>
> In one page I am making 2 AJAX calls, and I want to call a function on
> call back from AJAX. I found out a way to do it, its something like
> this,
>
>
>   $(window).bind("ajaxComplete", function() {
>   function1();
>   });
>
> Now problem here is, function1 is being called twice, on each AJAX
> callback. Is there any way so that i can call function1 only once.
>
> Thanks


[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread RSol

To replace ':)' to image I see 2 variants:
When I detect ':)' I:
1. Emulate two BackSpace and execCommand('InsertImage',false,img)
2. Get all text from '#editor', then String.replace(/:\)/g,img), then
put that in '#editor', then need moove cursor to the end of '#editor'.
I dont know how to move cursor to the end of editor.

I select 1st variant, and try emulate BackSpace key. Using $
('#editor').trigger("keypress", ) I cant do this - I dont ckow
how!
I find:

var evt = document.createEvent("KeyEvents");
evt.initKeyEvent(
  "keypress",//  in DOMString typeArg,
  true, //  in boolean canBubbleArg,
  true, //  in boolean cancelableArg,
  null, //  in nsIDOMAbstractView viewArg,  Specifies
UIEvent.view. This value may be null.
  false,//  in boolean ctrlKeyArg,
  false,//  in boolean altKeyArg,
  false,//  in boolean shiftKeyArg,
  false,//  in boolean metaKeyArg,
  8,   //  in unsigned long keyCodeArg,
  0);  //  in unsigned long charCodeArg);
$('#editor')[0].dispatchEvent(evt);

it's work in FF, but dont work in IE.

> Ah, I think I see the issue. Am I right in assuming that you don't
> want to simulate the backspace, but detect it?

I need to simulate the BackSpace

> Also, how are you keeping track of the replacement? It seems to me
> that you could do yourself a big favor and make what the user enters
> not what you show the user, so when they delete a smiley, you can just
> remove the whole thing?


[jQuery] Re: how to select all first td's inside all in a table

2009-01-08 Thread Chandan Luthra
$('tr').find('td:eq(0)')

this will work..

With Regards,
Chandan Luthra
Intelligrape Software Pvt. Ltd.


On Fri, Jan 9, 2009 at 4:04 AM, Mauricio (Maujor) Samy Silva <
css.mau...@gmail.com> wrote:

>
> $('tr > td') // match ALL td's that are children of a tr.
>
> $('tr td:first-child') // match ONLY td's that are first-child of a tr -
> this is the selector Tijmen is asking for.
>
> Regards,
> Mauricio
>
>
>
>  I believe you have two options:
>>
>
>  $('tr>td')
>>
>
>  or
>>
>
>  $('tr td:first-child')
>>
>> i've never used first-child myself so i may understand it wrongly.Let me
>> know !
>>
>
>


[jQuery] Re: Simulate BackSpace key

2009-01-08 Thread RSol

I try - this no work. :(

On 8 янв, 14:19, "jQuery Lover"  wrote:
> As far as I can remember trigger function takes only two parameters. The
> second parameter should be an array:
> $('#editor').trigger("keypress", [null,{which:
> 8,pageX:e.pageX,pageY:e.pageY}]);
>
> On Thu, Jan 8, 2009 at 3:57 PM, RSol  wrote:
>
> > I read that I can simulate keypress with code:
>
> > $('#editor').trigger("keypress", [],null,{which:
> > 8,pageX:e.pageX,pageY:e.pageY});
>
> > This code dont work.
>
> > Please help me solve this.
>
> --
>
> jQuery HowTo Resource 


[jQuery] Re: simple problem

2009-01-08 Thread CreativeMind

when i use the values , they are showing me as if working
properly...but when i check them using alert , i can't find any value..


[jQuery] Re: How to force processing of ColdFusion code when using .load

2009-01-08 Thread Shawn Grover


I've seen this caching problem before as well.  I handle it by just 
adding a random number to the URL I'm requesting.


i.e.

$.ajax({
  url: "mypage.cfm?r=" + Math.random(),
  data: myData,
  //. . .
});

If you are doing a GET request, the random parameter can go into the 
Data then.  The parameter name is arbitrary and is just ignored on the 
server side.


This essentially forces IE to request a NEW page each time.  It has the 
bonus that you don't need any special CF magic (such as adjusting 
headers).  But I'd imagine setting the headers is probably better in the 
long run.


HTH

Shawn

Carl Von Stetten wrote:

Rick,

I've had problems in the past with IE using the cached version of AJAX
content instead of reloading it.  The solution that generally works is
to add this to the top of the .cfm page your are loading via AJAX:




 wrote:

Hi, Carl...and thanks for the reply.

Yes, the conditional statements are in the include_menu_index.cfm file.

They determine the menu like so:


Announcements



RES 
Announcements


etc

FF3 does re-process the CF.  IE doesn't.  I confirmed that by putting this code
at the top of the include_menu_index.cfm file:


greeting = #greeting#

Next, I logged out, clearing the session variables, then logged back in
and got "greeting = Hi, Rick" at the top of the menu.

Then, before logging in as another user with different access to menu items, and
therefore a different menu structure, I changed "Rick" to "Bob" and saved the
include_menu_index.cfm file.

I logged in as the new user, and sure enough, I got "greeting = Hi, Rick" 
instead
of what was actually in the template, "greeting = Hi, Bob".

Only when I refreshed the page did I get the correct greeting, "greeting = Hi, 
Bob".

I've tried everything to try and figure out a way to get IE to re-render the 
menu,
but everything I've tried has failed.

I think I may have to use the cfc that processes the user's credentials to 
create
the appropriate menu and save that content as plain HTML, then load that with 
jQuery.
The loading seems to work with plain HTML, but without re-freshing, processing 
of
code doesn't run.

Thoughts?

Rick


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Carl Von Stetten
Sent: Thursday, January 08, 2009 5:13 PM
To: jQuery (English)
Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
.load
Rick,
Is the ColdFusion conditional code in the includes/
include_menu_index.cfm file?
If so, there may be issues with the AJAX request not using the same
ColdFusion session as your main page.
Also, you might check your AJAX response using Fiddler with IE and
compare it to the response in Firefox using Firebug.
HTH,
Carl
On Jan 8, 3:04 pm, "Rick Faircloth"  wrote:

How can I force the processing of ColdFusion code in a menu
segment when I have some login and I replace the menu HTML.
I had some conditional code like:

Announcements


RES 
Announcements

This code displays menu items only if the user has clearance
to access those sections in a site manager.
The problem I have is the IE (seems to be working fine in FF3)
is not processing the CF code unless I do a full page refresh...then it
displays the menu appropriately.
Here's the jQuery...any idea how to force IE to reprocess the CF, too?

$.ajax({
 type: "POST",
 url:  "login/login_processor.cfm",
 dataType: "json",
 data: formval,
 success: function(response){
   if (response.login == "Login Successful")
  { $('#logstatus').empty().append("Log Out");
$('#menu').hide();
$('#menu').load("includes/include_menu_index.cfm").show();
   tb_remove() }


[jQuery] Re: scrolling page when mouse at edge.

2009-01-08 Thread Shawn Grover


Sounds like a bad design in terms of usability to me.  What happens when 
the user wants to click the last visible item in the menu, and it tries 
to scroll?  Frustration.


I think a better option would be to put a scroll "block" at the bottom 
of the menu and only scroll when the user hovers over that.  YOu'd need 
a corresponding scroll block at the top (once scrolling has been done 
maybe?).


This sort of problem has been encountered before and has a number of 
solutions available.  But I think the best solution is to re-design the 
menu to avoid scrolling (if possible).


My thoughts  Take em for what they're worth.

Shawn

pantagruel wrote:

Hi,

somewhat off-topic, but jQuery is the javascript library I've
chosen...

I have a menu that is longer than the page. When I go down this menu
with the mouse I would like the page to scroll in the same direction
and speed as the mouse. I guess scrolling should actually only happen
if I get at the very edge of the page otherwise it could be quite
annoying.

Thanks,
Bryan Rasmussen


[jQuery] scrolling page when mouse at edge.

2009-01-08 Thread pantagruel

Hi,

somewhat off-topic, but jQuery is the javascript library I've
chosen...

I have a menu that is longer than the page. When I go down this menu
with the mouse I would like the page to scroll in the same direction
and speed as the mouse. I guess scrolling should actually only happen
if I get at the very edge of the page otherwise it could be quite
annoying.

Thanks,
Bryan Rasmussen


[jQuery] jQuery - Binding to Ajax Event

2009-01-08 Thread goodsanket

Hi all

I am developing a portal and i am kind of stuck.
I am using multiple AJAX calls to get data dynamically from a JSON
file.

In one page I am making 2 AJAX calls, and I want to call a function on
call back from AJAX. I found out a way to do it, its something like
this,


   $(window).bind("ajaxComplete", function() {
   function1();
   });

Now problem here is, function1 is being called twice, on each AJAX
callback. Is there any way so that i can call function1 only once.

Thanks


[jQuery] Re: having a child div inherit a parent width

2009-01-08 Thread Karl Swedberg

Hi again,

This should work:

$(document).ready(function() {

  var cellWidth = {
 searchUser: [80, 110, 145, 70, 100, 100, 236],
 searchAcct: [80, 130, 80, 80, 80, 190, 201]
  };

  $.each(cellWidth, function(key, val) {
for (var i=0, cl= val.length; iNow if you add another table, (for example, one with  
class="searchFoo") all you have to do is add another element to the  
cellWidth object:


  var cellWidth = {
 searchUser: [80, 110, 145, 70, 100, 100, 236],
 searchAcct: [80, 130, 80, 80, 80, 190, 201],
 searchFoo: [80, 130, 190, 201, 80, 80, 80]
  };


--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jan 8, 2009, at 8:29 PM, roxstyle wrote:



i actually started with more than one table, and my clunky code was
working, but not clean.  The following is the original for 2 tables.

$(document).ready(function() {
   //usertool-search-user
   $(".searchUser tbody td:first-child").css({"width":"80px"});
   $(".searchUser tbody td:nth-child(2)").css({"width":"110px"});
   $(".searchUser tbody td:nth-child(3)").css({"width":"145px"});
   $(".searchUser tbody td:nth-child(4)").css({"width":"70px"});
   $(".searchUser tbody td:nth-child(5)").css({"width":"100px"});
   $(".searchUser tbody td:nth-child(6)").css({"width":"100px"});
   $(".searchUser tbody td:nth-child(7)").css({"width":"236px"});


   //usertool-search-account
   $(".searchAcct tbody td:first-child").css({"width":"80px"});
   $(".searchAcct tbody td:nth-child(2)").css({"width":"130px"});
   $(".searchAcct tbody td:nth-child(3)").css({"width":"80px"});
   $(".searchAcct tbody td:nth-child(4)").css({"width":"80px"});
   $(".searchAcct tbody td:nth-child(5)").css({"width":"80px"});
   $(".searchAcct tbody td:nth-child(6)").css({"width":"190px"});
   $(".searchAcct tbody td:nth-child(7)").css({"width":"201px"});
   $(".tbl tbody td").each(function(i){
   var $tdWidth = $(this).css("width");
   $(this).children().css({'overflow':'hidden','width':$tdWidth});
   });

});

i tried to adjust the code (above) with the (cleaner) sample Karl
Swedburg suggested, but i have not been successful, yet. i am trying
to do this for about 10 tables altogether. any help or direction to
similar example would be appreciated. This worked when i used it for a
single table, i just don't understand how to set the same method up
for multiple tables (all with different  cell arrays and widths).Thank
you.

$(document).ready(function() {
   $('.searchUser tbody td') function() {
   var cellWidth = [80, 110, 145, 70, 100, 100, 236];
   for (var i=0, cl= cellWidth.length; i wrote:

thank you, so much. I need to think less in css and more in jquery.
And also thank you for your great site, i just found it, and ordered
your book.

On Jan 8, 7:38 am, Karl Swedberg  wrote:


This might be a little cleaner:



   $(document).ready(function(){
 var cellWidth = [80, 110, 145, 70, 100, 100, 236];
 for (var i=0, cl= cellWidth.length; i


(untested)



--Karl




Karl Swedbergwww.englishrules.comwww.learningjquery.com



On Jan 7, 2009, at 5:26 PM, roxstyle wrote:



$(document).ready(function(){
   $(".searchUser tbody td:first-child").css({"width":"80px"});
   $(".searchUser tbody td:nth-child(2)").css({"width":"110px"});
   $(".searchUser tbody td:nth-child(3)").css({"width":"145px"});
   $(".searchUser tbody td:nth-child(4)").css({"width":"70px"});
   $(".searchUser tbody td:nth-child(5)").css({"width":"100px"});
   $(".searchUser tbody td:nth-child(6)").css({"width":"100px"});
   $(".searchUser tbody td:nth-child(7)").css({"width":"236px"});



   $(".tbl tbody td").each(function(i){
   var $tdWidth = $(this).css("width");
   $(this).children().css({'overflow':'hidden','width':$tdWidth});
   });



});


ok, i have this working for my sample. Along with some added  
insight.
(1) the children need to inherit the "td" given width- not the  
width
that the browser sees. (2)The only way i could get this to  
inherit, is
to have the width declared inline (now generated from the js file  
and

not the css file), then the children can inherit the style "width".
I do not like all these inline styles showing up in the code,
but...its working.



On Jan 7, 12:06 pm, amuhlou  wrote:

you're quite welcome :)



On Jan 7, 3:02 pm, roxstyle  wrote:



thank you so much, that is going to work.



On Jan 7, 11:55 am, amuhlou  wrote:



I accidentally replied directly to the author, so for anyone
curious
about the same thing, you could use the following code:



$(document).ready(function() {
$(".tbl tbody td").each(function(i) {
var $tdWidth = $(this).width();
$(this).children().width($tdWidth);
});



});


This code goes through the .tbl table, and for each td it  
finds its

width and then applies that width to its children.



On Jan 7, 2:04 pm, roxstyle  wrote:



no, not exactly.
if the div contains a long email or url with no spaces-the  div
will
expan

[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Ricardo Tomasi

Yes but what happens when you find an error in your script? It might
be a very basic mistake but you won't have a clue if you don't know
javascript itself. What happens 5 years from know if a totally
different library, with different syntax, takes over?

I agree with Peter Higgins, it's much more useful to teach the basics
first, then introduce jQuery, if they got the very basics then they
can learn the rest on their own. It's like teaching someone to use the
Blueprint CSS framework and not explaining what classes really are.
They`ll find themselves lost at the first adversity.

- ricardo

Do you mean 2 hours a week for 3 years? That's enough to learn well 5
different languages :D

On Jan 8, 8:30 pm, Kean  wrote:
> Your audience are designers, they will pick up jQuery faster because
> they think in CSS.
>
> At what point do you teach them javascript?
> When you teach them how to create plugins for jQuery.
>
> I hope this helps.
>
> On Jan 8, 2:13 pm, Nikola  wrote:
>
> > Why not integrate the basic "JavaScript Fundamentals" in each jQuery
> > lesson.  You could show some general examples and explain the
> > rudimentary JavaScript principal (I'm thinking a 15 minute
> > introduction...) then teach the jQuery and demonstrate how and why
> > jQuery is the "write less, do more" JavaScript library..  This way,
> > students get the gist of the JavaScript while learning jQuery. This
> > may not be as desirable as learning jQuery on top of a strong
> > JavaScript foundation but it can certainly help them to become
> > stronger jQuery developers while giving them an introductory
> > foundation in JavaScript principals.


[jQuery] Re: (smooth) scroll to anchor but...

2009-01-08 Thread Karl Swedberg

oh wow. good call, Ariel. thanks!

--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jan 8, 2009, at 4:42 PM, Ariel Flesler wrote:



@Karl

$('html, body') is a simple, yet bad, approach.
It's one or the other not both.
Browsers like Opera that react to both elements, can go mad when doing
this.

Cheers

--
Ariel Flesler
http://flesler.blogspot.com

On Jan 8, 1:20 pm, Karl Swedberg  wrote:

Hi there,

Here's a quick and dirty way to do it, off the top of my head.  
Totally

untested, but should get you started, at least:

// determine left and top position of img

var imgLeft = $('#yourImage').offset().left;
var imgTop = $('#yourImage').offset().top;

// on click, grab the coords attribute of the area and add them to  
the

img position for animating

$('area').click(function() {
   var toArea = $(this).attr('href');
   var coords = $(toArea).attr('coords').split(',');
   $('html, body').animate({
 scrollLeft: imgLeft + coords[0],
 scrollTop: imgTop + coords[1],
   }, 400);

});

--Karl


Karl Swedbergwww.englishrules.comwww.learningjquery.com

On Jan 7, 2009, at 5:14 PM, schnuck wrote:




...what if the areas i need to scroll to are defined as anchors in
html  elements on top of a large inline image? and the areas  
that

trigger the links are image map areas too. clicking on the image map
areas scroll from one area to another. ideally not using absolute
positioning, but with html anchors and their IDs.



i tried modifying this technique here for no avail:


http://www.learningjquery.com/2007/10/improved-animated-scrolling-scr 
...



and this one here:



http://plugins.jquery.com/project/scrollto



any help appreciated - thanks!







[jQuery] Re: How to force processing of ColdFusion code when using .load

2009-01-08 Thread Rick Faircloth

Well, Carl, I think you've done it.

I had tried the cfheaders you have below, except for the
expires now header.  That one seems to have done it!

Thanks so much!

Rick

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Carl Von Stetten
> Sent: Thursday, January 08, 2009 7:20 PM
> To: jQuery (English)
> Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
> .load
> 
> 
> Rick,
> 
> I've had problems in the past with IE using the cached version of AJAX
> content instead of reloading it.  The solution that generally works is
> to add this to the top of the .cfm page your are loading via AJAX:
> 
> 
> 
> 
>  
> See if that helps.
> Carl
> 
> On Jan 8, 5:08 pm, "Rick Faircloth"  wrote:
> > Hi, Carl...and thanks for the reply.
> >
> > Yes, the conditional statements are in the include_menu_index.cfm file.
> >
> > They determine the menu like so:
> >
> >                  > session.announcements eq 1>
> >                          > href="cfm/announcements.cfm">Announcements
> >                 
> >
> >                  > session.res_announcements eq 1>
> >                         RES 
> > Announcements
> >                 
> >
> > etc
> >
> > FF3 does re-process the CF.  IE doesn't.  I confirmed that by putting this 
> > code
> > at the top of the include_menu_index.cfm file:
> >
> > 
> > greeting = #greeting#
> >
> > Next, I logged out, clearing the session variables, then logged back in
> > and got "greeting = Hi, Rick" at the top of the menu.
> >
> > Then, before logging in as another user with different access to menu 
> > items, and
> > therefore a different menu structure, I changed "Rick" to "Bob" and saved 
> > the
> > include_menu_index.cfm file.
> >
> > I logged in as the new user, and sure enough, I got "greeting = Hi, Rick" 
> > instead
> > of what was actually in the template, "greeting = Hi, Bob".
> >
> > Only when I refreshed the page did I get the correct greeting, "greeting = 
> > Hi, Bob".
> >
> > I've tried everything to try and figure out a way to get IE to re-render 
> > the menu,
> > but everything I've tried has failed.
> >
> > I think I may have to use the cfc that processes the user's credentials to 
> > create
> > the appropriate menu and save that content as plain HTML, then load that 
> > with jQuery.
> > The loading seems to work with plain HTML, but without re-freshing, 
> > processing of
> > code doesn't run.
> >
> > Thoughts?
> >
> > Rick
> >
> > > -Original Message-
> > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> > > Behalf Of Carl Von
Stetten
> > > Sent: Thursday, January 08, 2009 5:13 PM
> > > To: jQuery (English)
> > > Subject: [jQuery] Re: How to force processing of ColdFusion code when 
> > > using .load
> >
> > > Rick,
> >
> > > Is the ColdFusion conditional code in the includes/
> > > include_menu_index.cfm file?
> >
> > > If so, there may be issues with the AJAX request not using the same
> > > ColdFusion session as your main page.
> >
> > > Also, you might check your AJAX response using Fiddler with IE and
> > > compare it to the response in Firefox using Firebug.
> >
> > > HTH,
> > > Carl
> >
> > > On Jan 8, 3:04 pm, "Rick Faircloth"  wrote:
> > > > How can I force the processing of ColdFusion code in a menu
> > > > segment when I have some login and I replace the menu HTML.
> >
> > > > I had some conditional code like:
> >
> > > >                  > > > session.announcements eq 1>
> > > >                          > > > href="cfm/announcements.cfm">Announcements
> > > >                 
> >
> > > >                  > > > session.res_announcements
eq 1>
> > > >                         RES 
> > > > Announcements
> > > >                 
> >
> > > > This code displays menu items only if the user has clearance
> > > > to access those sections in a site manager.
> >
> > > > The problem I have is the IE (seems to be working fine in FF3)
> > > > is not processing the CF code unless I do a full page refresh...then it
> > > > displays the menu appropriately.
> >
> > > > Here's the jQuery...any idea how to force IE to reprocess the CF, too?
> >
> > > > > $.ajax({
> > > > >      type: "POST",
> > > > >      url:  "login/login_processor.cfm",
> > > > >      dataType: "json",
> > > > >      data: formval,
> > > > >      success: function(response){
> >
> > > > >            if (response.login == "Login Successful")
> > > > >               { $('#logstatus').empty().append("Log Out");
> > > > >                 $('#menu').hide();
> > > > >                 
> > > > > $('#menu').load("includes/include_menu_index.cfm").show();
> > > > >            tb_remove() }



[jQuery] Re: Best way to preload an image to obtain dimensions

2009-01-08 Thread brian

On Thu, Jan 8, 2009 at 6:06 PM, nabrown78  wrote:
>
> Hi All,
> I am building a simple little gallery where you click on a thumbnail,
> and a larger image displays on the same page. I was trying to adjust
> the padding around the large image using the new image's dimensions. I
> pieced together this image preloading code (see below), but I don't
> fully understand it (is it just loading the new image into the DOM to
> be able to access its dimensions?) and I don't know if it's the best
> way to go about it.
>
> Many thanks for any advice,
> Nora Brown
>
> $(document).ready(function(){
>
>$(".thumbs a").click(function(){
>
>var largePath = $(this).attr("href");
>var largeAlt = $(this).attr("title");
>
>// Image preload process
>var imagePreloader = new Image();
>imagePreloader.src = largePath;
>imagePreloader.onload = function() {
>alert(imagePreloader.height);
>};
>
>$("#largeImg img").attr({ src: largePath, alt: largeAlt });
>return false;
>})
>
> });
>

We'll have to assume you have some object named, imagePreloader.
ANyway, that code doesn't seem especially helpful, as it's not loading
the image until the thumbnail is clicked.

If you're going to load the large version in the same page, better to
forget about thumbnails altogether, load your images, and reduce the
size via CSS. Store the original dimensions in the jQuery data
collection and retrieve it when the image's anchor is clicked. Then
clone the image, though with the original dimension. This way, if
you're doing something fancy like with a modal box, thickbox, or the
like, you can animate its size change, then let the cloned image fade
in.

Or something like that.


[jQuery] Re: attr('type') gives me checkbox instead of radio

2009-01-08 Thread MorningZ

I'm not sure where you are getting your documentation from, but
"@param" is depreciated

this code gives "radio"

http://paste.pocoo.org/show/98695/




On Jan 8, 9:47 pm, bob  wrote:
> Female
> Male
>
> var type = #('inp...@name=gender]').attr('type');
>
> alert(type);
>
> Why do I get checkbox instead of radio?


[jQuery] attr('type') gives me checkbox instead of radio

2009-01-08 Thread bob

Female
Male

var type = #('inp...@name=gender]').attr('type');

alert(type);

Why do I get checkbox instead of radio?


[jQuery] Swap Image when click

2009-01-08 Thread jeffreych...@gmail.com

Hi devs,

I kinda new with jquery and would like to ask, has anyone tried to use
jquery to swap images when click. Its a linked image. SO when you
click the image it would swap into another one.

Thanks.


[jQuery] [validate] message containers and valid XHTML markup?

2009-01-08 Thread martin

>From what I can make of the documentation, the only way to use
validation containers is to put something like...

class="{required:true,minlength:3}"

into your HTML form elements. Now this works just fine for me,
however, its not valid XHTML.

Is there any way to have valid XHTML and use error containers?


[jQuery] Re: having a child div inherit a parent width

2009-01-08 Thread roxstyle

i actually started with more than one table, and my clunky code was
working, but not clean.  The following is the original for 2 tables.

$(document).ready(function() {
//usertool-search-user
$(".searchUser tbody td:first-child").css({"width":"80px"});
$(".searchUser tbody td:nth-child(2)").css({"width":"110px"});
$(".searchUser tbody td:nth-child(3)").css({"width":"145px"});
$(".searchUser tbody td:nth-child(4)").css({"width":"70px"});
$(".searchUser tbody td:nth-child(5)").css({"width":"100px"});
$(".searchUser tbody td:nth-child(6)").css({"width":"100px"});
$(".searchUser tbody td:nth-child(7)").css({"width":"236px"});


//usertool-search-account
$(".searchAcct tbody td:first-child").css({"width":"80px"});
$(".searchAcct tbody td:nth-child(2)").css({"width":"130px"});
$(".searchAcct tbody td:nth-child(3)").css({"width":"80px"});
$(".searchAcct tbody td:nth-child(4)").css({"width":"80px"});
$(".searchAcct tbody td:nth-child(5)").css({"width":"80px"});
$(".searchAcct tbody td:nth-child(6)").css({"width":"190px"});
$(".searchAcct tbody td:nth-child(7)").css({"width":"201px"});
$(".tbl tbody td").each(function(i){
var $tdWidth = $(this).css("width");
$(this).children().css({'overflow':'hidden','width':$tdWidth});
});

});

i tried to adjust the code (above) with the (cleaner) sample Karl
Swedburg suggested, but i have not been successful, yet. i am trying
to do this for about 10 tables altogether. any help or direction to
similar example would be appreciated. This worked when i used it for a
single table, i just don't understand how to set the same method up
for multiple tables (all with different  cell arrays and widths).Thank
you.

$(document).ready(function() {
$('.searchUser tbody td') function() {
var cellWidth = [80, 110, 145, 70, 100, 100, 236];
for (var i=0, cl= cellWidth.length; i wrote:
> thank you, so much. I need to think less in css and more in jquery.
> And also thank you for your great site, i just found it, and ordered
> your book.
>
> On Jan 8, 7:38 am, Karl Swedberg  wrote:
>
> > This might be a little cleaner:
>
> >    $(document).ready(function(){
> >      var cellWidth = [80, 110, 145, 70, 100, 100, 236];
> >      for (var i=0, cl= cellWidth.length; i >        $('td:nth-child(' + (i+1) + ')').width(cellWidth[i])
> >          .children().css({overflow: 'hidden'}).width(cellWidth[i]);
> >      };
> >    });
>
> > (untested)
>
> > --Karl
>
> > 
> > Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> > On Jan 7, 2009, at 5:26 PM, roxstyle wrote:
>
> > > $(document).ready(function(){
> > >    $(".searchUser tbody td:first-child").css({"width":"80px"});
> > >    $(".searchUser tbody td:nth-child(2)").css({"width":"110px"});
> > >    $(".searchUser tbody td:nth-child(3)").css({"width":"145px"});
> > >    $(".searchUser tbody td:nth-child(4)").css({"width":"70px"});
> > >    $(".searchUser tbody td:nth-child(5)").css({"width":"100px"});
> > >    $(".searchUser tbody td:nth-child(6)").css({"width":"100px"});
> > >    $(".searchUser tbody td:nth-child(7)").css({"width":"236px"});
>
> > >    $(".tbl tbody td").each(function(i){
> > >    var $tdWidth = $(this).css("width");
> > >    $(this).children().css({'overflow':'hidden','width':$tdWidth});
> > >    });
>
> > > });
>
> > > ok, i have this working for my sample. Along with some added insight.
> > > (1) the children need to inherit the "td" given width- not the width
> > > that the browser sees. (2)The only way i could get this to inherit, is
> > > to have the width declared inline (now generated from the js file and
> > > not the css file), then the children can inherit the style "width".
> > > I do not like all these inline styles showing up in the code,
> > > but...its working.
>
> > > On Jan 7, 12:06 pm, amuhlou  wrote:
> > >> you're quite welcome :)
>
> > >> On Jan 7, 3:02 pm, roxstyle  wrote:
>
> > >>> thank you so much, that is going to work.
>
> > >>> On Jan 7, 11:55 am, amuhlou  wrote:
>
> >  I accidentally replied directly to the author, so for anyone  
> >  curious
> >  about the same thing, you could use the following code:
>
> >  $(document).ready(function() {
> >          $(".tbl tbody td").each(function(i) {
> >                  var $tdWidth = $(this).width();
> >                  $(this).children().width($tdWidth);
> >          });
>
> >  });
>
> >  This code goes through the .tbl table, and for each td it finds its
> >  width and then applies that width to its children.
>
> >  On Jan 7, 2:04 pm, roxstyle  wrote:
>
> > > no, not exactly.
> > > if the div contains a long email or url with no spaces-the  div  
> > > will
> > > expand beyond the intended width set for the "td" and essentailly
> > > break the table layout. What i am trying to achieve is to place  
> > > the
> > > actual "td" content in a "div" and have the "div" (1)

[jQuery] Re: How to force processing of ColdFusion code when using .load

2009-01-08 Thread Carl Von Stetten

Rick,

I've had problems in the past with IE using the cached version of AJAX
content instead of reloading it.  The solution that generally works is
to add this to the top of the .cfm page your are loading via AJAX:




 wrote:
> Hi, Carl...and thanks for the reply.
>
> Yes, the conditional statements are in the include_menu_index.cfm file.
>
> They determine the menu like so:
>
>                  session.announcements eq 1>
>                          href="cfm/announcements.cfm">Announcements
>                 
>
>                  session.res_announcements eq 1>
>                         RES 
> Announcements
>                 
>
> etc
>
> FF3 does re-process the CF.  IE doesn't.  I confirmed that by putting this 
> code
> at the top of the include_menu_index.cfm file:
>
> 
> greeting = #greeting#
>
> Next, I logged out, clearing the session variables, then logged back in
> and got "greeting = Hi, Rick" at the top of the menu.
>
> Then, before logging in as another user with different access to menu items, 
> and
> therefore a different menu structure, I changed "Rick" to "Bob" and saved the
> include_menu_index.cfm file.
>
> I logged in as the new user, and sure enough, I got "greeting = Hi, Rick" 
> instead
> of what was actually in the template, "greeting = Hi, Bob".
>
> Only when I refreshed the page did I get the correct greeting, "greeting = 
> Hi, Bob".
>
> I've tried everything to try and figure out a way to get IE to re-render the 
> menu,
> but everything I've tried has failed.
>
> I think I may have to use the cfc that processes the user's credentials to 
> create
> the appropriate menu and save that content as plain HTML, then load that with 
> jQuery.
> The loading seems to work with plain HTML, but without re-freshing, 
> processing of
> code doesn't run.
>
> Thoughts?
>
> Rick
>
> > -Original Message-
> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> > Behalf Of Carl Von Stetten
> > Sent: Thursday, January 08, 2009 5:13 PM
> > To: jQuery (English)
> > Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
> > .load
>
> > Rick,
>
> > Is the ColdFusion conditional code in the includes/
> > include_menu_index.cfm file?
>
> > If so, there may be issues with the AJAX request not using the same
> > ColdFusion session as your main page.
>
> > Also, you might check your AJAX response using Fiddler with IE and
> > compare it to the response in Firefox using Firebug.
>
> > HTH,
> > Carl
>
> > On Jan 8, 3:04 pm, "Rick Faircloth"  wrote:
> > > How can I force the processing of ColdFusion code in a menu
> > > segment when I have some login and I replace the menu HTML.
>
> > > I had some conditional code like:
>
> > >                  > > session.announcements eq 1>
> > >                          > > href="cfm/announcements.cfm">Announcements
> > >                 
>
> > >                  > > session.res_announcements eq 1>
> > >                         RES 
> > > Announcements
> > >                 
>
> > > This code displays menu items only if the user has clearance
> > > to access those sections in a site manager.
>
> > > The problem I have is the IE (seems to be working fine in FF3)
> > > is not processing the CF code unless I do a full page refresh...then it
> > > displays the menu appropriately.
>
> > > Here's the jQuery...any idea how to force IE to reprocess the CF, too?
>
> > > > $.ajax({
> > > >      type: "POST",
> > > >      url:  "login/login_processor.cfm",
> > > >      dataType: "json",
> > > >      data: formval,
> > > >      success: function(response){
>
> > > >            if (response.login == "Login Successful")
> > > >               { $('#logstatus').empty().append("Log Out");
> > > >                 $('#menu').hide();
> > > >                 
> > > > $('#menu').load("includes/include_menu_index.cfm").show();
> > > >            tb_remove() }


[jQuery] Re: Select inputs

2009-01-08 Thread Lay András

Hello!

On Fri, Jan 9, 2009 at 12:51 AM, Karl Rudd  wrote:
> $('input[name^=xxx]')
>
> http://docs.jquery.com/Selectors/attributeStartsWith#attributevalue

Oh, I don't see this before...

Thank You!


[jQuery] Re: How to force processing of ColdFusion code when using .load

2009-01-08 Thread Rick Faircloth

Hi, Carl...and thanks for the reply.

Yes, the conditional statements are in the include_menu_index.cfm file.

They determine the menu like so:


Announcements



RES 
Announcements



etc

FF3 does re-process the CF.  IE doesn't.  I confirmed that by putting this code
at the top of the include_menu_index.cfm file:


greeting = #greeting#

Next, I logged out, clearing the session variables, then logged back in
and got "greeting = Hi, Rick" at the top of the menu.

Then, before logging in as another user with different access to menu items, and
therefore a different menu structure, I changed "Rick" to "Bob" and saved the
include_menu_index.cfm file.

I logged in as the new user, and sure enough, I got "greeting = Hi, Rick" 
instead
of what was actually in the template, "greeting = Hi, Bob".

Only when I refreshed the page did I get the correct greeting, "greeting = Hi, 
Bob".

I've tried everything to try and figure out a way to get IE to re-render the 
menu,
but everything I've tried has failed.

I think I may have to use the cfc that processes the user's credentials to 
create
the appropriate menu and save that content as plain HTML, then load that with 
jQuery.
The loading seems to work with plain HTML, but without re-freshing, processing 
of
code doesn't run.

Thoughts?

Rick

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Carl Von Stetten
> Sent: Thursday, January 08, 2009 5:13 PM
> To: jQuery (English)
> Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
> .load
> 
> 
> Rick,
> 
> Is the ColdFusion conditional code in the includes/
> include_menu_index.cfm file?
> 
> If so, there may be issues with the AJAX request not using the same
> ColdFusion session as your main page.
> 
> Also, you might check your AJAX response using Fiddler with IE and
> compare it to the response in Firefox using Firebug.
> 
> HTH,
> Carl
> 
> On Jan 8, 3:04 pm, "Rick Faircloth"  wrote:
> > How can I force the processing of ColdFusion code in a menu
> > segment when I have some login and I replace the menu HTML.
> >
> > I had some conditional code like:
> >
> >                  > session.announcements eq 1>
> >                          > href="cfm/announcements.cfm">Announcements
> >                 
> >
> >                  > session.res_announcements eq 1>
> >                         RES 
> > Announcements
> >                 
> >
> > This code displays menu items only if the user has clearance
> > to access those sections in a site manager.
> >
> > The problem I have is the IE (seems to be working fine in FF3)
> > is not processing the CF code unless I do a full page refresh...then it
> > displays the menu appropriately.
> >
> > Here's the jQuery...any idea how to force IE to reprocess the CF, too?
> >
> > > $.ajax({
> > >      type: "POST",
> > >      url:  "login/login_processor.cfm",
> > >      dataType: "json",
> > >      data: formval,
> > >      success: function(response){
> >
> > >            if (response.login == "Login Successful")
> > >               { $('#logstatus').empty().append("Log Out");
> > >                 $('#menu').hide();
> > >                 $('#menu').load("includes/include_menu_index.cfm").show();
> > >            tb_remove() }



[jQuery] Re: Select inputs

2009-01-08 Thread Karl Rudd
$('input[name^=xxx]')

http://docs.jquery.com/Selectors/attributeStartsWith#attributevalue

Karl Rudd

On Fri, Jan 9, 2009 at 9:14 AM, Lay András  wrote:
>
> Hello!
>
> How can I select all checkbox inputs which names/ids starting with
> "xxx"? I tried this, but not working:
>
> $('input[name=xxx*]')
>


[jQuery] Select inputs

2009-01-08 Thread Lay András

Hello!

How can I select all checkbox inputs which names/ids starting with
"xxx"? I tried this, but not working:

$('input[name=xxx*]')


[jQuery] jqModal problem in firefox not firing ready

2009-01-08 Thread Kid_Niki


Hi everyone,
I have a basic jqModal page: 
---

... blah blah



 # Close 

  

Please wait...  '



... blah blah




$().ready(function(){

// select + reference "triggering element" -- will pass 
to $.jqm()
  var triggers = $(".ex3bTrigger");
var t = $('div.jqmAlertContent');

  // NOTE; we could have used 
document.getElementById(), or selected
  //  multiple elemets with $(..selector..) and passed 
the trigger
  //  as a jQuery object. OR, just include the string 
'#ex3btrigger' 
  //  as the trigger parameter (as typically 
demonstrated).
  
  //  NOTE; we supply a target for the ajax return. 
This allows us
  //   to keep the structure of the alert window. An 
element can 
  //   also be passed (see the documentation) as target.
   
$('#ex3b')
//$('#ex3b').jqResize('.jqResize')

  $('#ex3b').jqm({
overlay: 88,
zIndex: 1000,
modal: false,
trigger: triggers,
ajax: '@href',
//the following creates a fade effect...
//onHide: function(h) { 
  //t.html('Please Wait...');  // Clear Content 
HTML on Hide.
 // h.o.remove(); // remove overlay
  //h.w.fadeOut(888); // hide window  
//},
target: t
})  
.jqDrag('.jqmAlertTitle');
  
  // Close Button Highlighting. IE doesn't support 
:hover. Surprise?
  if($.browser.msie) {
  $('div.jqmAlert .jqmClose')
  .hover(
function(){ $(this).addClass('jqmCloseHover'); 
}, 
function(){ 
$(this).removeClass('jqmCloseHover'); });
  }
});


-
I load via ajax a php that contains the following jquery script that creates
a image preview when hovering over some thumbnails:
---
html
... blah blah

echo' a target="_blank" href="'.base_url().$image1full.'" class="preview" >
<  i m g border="0" src="'.base_url().$image1.'" width="80" height="60"; 

... blah blah
/html


this.imagePreview = function(){ 
/* CONFIG */

xOffset = 30;
yOffset = 20;

// these 2 variable determine popup's distance from the cursor
// you might want to adjust to get the right result

/* END CONFIG */
$("a.preview").hover(function(e)
{
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "" + this.t : "";

$("body").append(" "+ this.href +" "+ c 
+"");
$("#preview")
.css("top",(e.pageY - xOffset - 
($("#preview").height())) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");

},
function()
{
this.title = this.t;
$("#preview").remove();
}); //end of a.preview hover function

$("a.preview").mousemove(function(e)
{
$("#preview")
.css("top",(e.pageY - xOffset - 
($("#preview").height()) ) + "px")
.css("left",(e.pageX + yOffset) + "px");
}); //end of a.preview mousemove function


//handle previewleft
$("a.previewleft").hover(function(e)
{
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "" + this.t : "";
$("body").append(" "+ this.href +" "+ c 
+"");
$("#previewleft")
.css("top",(e.pageY - xOffset - 
($("#

[jQuery] Re: get tag name

2009-01-08 Thread Alfonso Harita

http://www.mail-archive.com/disc...@jquery.com/msg07467.html

On Jan 7, 6:40 pm, bob  wrote:
> 
> 
> January
> February
>
> function do_something_based_on_tag_name(selector) {
>
>         if(???=='select') {}
>
> }
>
> var selector = jq('#month');
>
> do_something_based_on_tag_name(selector);
>
> How do I get tag name from "selector" variable?


[jQuery] Getting an array via $.post

2009-01-08 Thread emmj...@gmail.com

How would I go about getting an array from a php script. As I
understand it the data returned to $.post is only things that are
echoed in the php file. I've tried using return $array; in php but it
doesn't work.

Any help would be greatly appreciated.


[jQuery] Best way to preload an image to obtain dimensions

2009-01-08 Thread nabrown78

Hi All,
I am building a simple little gallery where you click on a thumbnail,
and a larger image displays on the same page. I was trying to adjust
the padding around the large image using the new image's dimensions. I
pieced together this image preloading code (see below), but I don't
fully understand it (is it just loading the new image into the DOM to
be able to access its dimensions?) and I don't know if it's the best
way to go about it.

Many thanks for any advice,
Nora Brown

$(document).ready(function(){

$(".thumbs a").click(function(){

var largePath = $(this).attr("href");
var largeAlt = $(this).attr("title");

// Image preload process
var imagePreloader = new Image();
imagePreloader.src = largePath;
imagePreloader.onload = function() {
alert(imagePreloader.height);
};

$("#largeImg img").attr({ src: largePath, alt: largeAlt });
return false;
})

});


[jQuery] Calling images programatically from a database?

2009-01-08 Thread tovi

Hi, so I've got this problem which I just can't seem to solve, even
after looking at many resources and this archive. Have a look-see,
please. I'm currently not using jquery for this function, but I
imagine I could be.

What I'm trying to do is call on a record from a database which will
have, among other things, 1-4 pictures associated with it. Ideally, I
want one statement to request all images in the record, and then one
statement to loop through the results and display however many images
are found. Each picture file is called picture1, picture2, picture3
and picture4. An important point is that if there is anything less
than four pictures in the record, that the code should just grab
whatever's there and then move on. Below is a copy of the script I'm
currently using, which works as intended in IE6, but FF gets hung up
when it finds there's anything less than four pictures. (I know the
following script calls each picture separately, but I don't know how
to make the loop.)



image2 = "picture2"
image3 = "picture3"
image4 = "picture4"
imgNo=0

function newimage2() {
imgNo+=1
document.getElementById("image2").innerHTML=''
if (imgNo>image2.length) {document.getElementById
("image2").innerHTML='';return}
}

function newimage3() {
imgNo+=1
document.getElementById("image3").innerHTML=''
if (imgNo>image3.length) {document.getElementById
("image3").innerHTML='';return}
}

function newimage4() {
imgNo+=1
document.getElementById("image4").innerHTML=''
if (imgNo>image4.length) {document.getElementById
("image4").innerHTML='';return}
}



...and inside the :












[jQuery] Re: How to force processing of ColdFusion code when using .load

2009-01-08 Thread Carl Von Stetten

Rick,

Is the ColdFusion conditional code in the includes/
include_menu_index.cfm file?

If so, there may be issues with the AJAX request not using the same
ColdFusion session as your main page.

Also, you might check your AJAX response using Fiddler with IE and
compare it to the response in Firefox using Firebug.

HTH,
Carl

On Jan 8, 3:04 pm, "Rick Faircloth"  wrote:
> How can I force the processing of ColdFusion code in a menu
> segment when I have some login and I replace the menu HTML.
>
> I had some conditional code like:
>
>                  session.announcements eq 1>
>                          href="cfm/announcements.cfm">Announcements
>                 
>
>                  session.res_announcements eq 1>
>                         RES 
> Announcements
>                 
>
> This code displays menu items only if the user has clearance
> to access those sections in a site manager.
>
> The problem I have is the IE (seems to be working fine in FF3)
> is not processing the CF code unless I do a full page refresh...then it
> displays the menu appropriately.
>
> Here's the jQuery...any idea how to force IE to reprocess the CF, too?
>
> > $.ajax({
> >      type: "POST",
> >      url:  "login/login_processor.cfm",
> >      dataType: "json",
> >      data: formval,
> >      success: function(response){
>
> >            if (response.login == "Login Successful")
> >               { $('#logstatus').empty().append("Log Out");
> >                 $('#menu').hide();
> >                 $('#menu').load("includes/include_menu_index.cfm").show();
> >            tb_remove() }


[jQuery] Re: Trouble refreshing div with .load

2009-01-08 Thread Carl Von Stetten

Rick,

Is #menu empty to start with?  If not, you might want to change your
code to:

$('#menu').hide().empty().load("includes/include_menu_index.cfm").show
();

Another think to consider is whether IE is actually getting back the
json data correctly.  You might want to examine the response using
Fiddler or another similar tool.

HTH,
Carl

On Jan 8, 2:08 pm, "Rick Faircloth"  wrote:
> Anyone have any ideas on this?
>
>
>
> > I'm using the following code to refresh a menu
> > based on a user's access privileges.  The login
> > is via a modal window.
>
> > $.ajax({
> >      type: "POST",
> >      url:  "login/login_processor.cfm",
> >      dataType: "json",
> >      data: formval,
> >      success: function(response){
>
> >            if (response.login == "Login Successful")
> >               { $('#logstatus').empty().append("Log Out");
> >                 $('#menu').hide();
> >                 $('#menu').load("includes/include_menu_index.cfm").show();
> >            tb_remove() }
>
> > It's performing property in FF3, but IE6 and IE7
> > aren't refreshing the #menu.  I have to refresh the
> > page manually to get the menu to display correct items.
>
> > Is there some way I can rewrite this part:
>
> > $('#menu').hide();
> > $('#menu').load("includes/include_menu_index.cfm").show();
>
> > or should that be sufficient.
>
> > Thanks,
>
> > Rick


[jQuery] Dynamic select menus widgit

2009-01-08 Thread Dan

I have a script that selects rows from a database with a select menu
for each field.  Some php runs prior to page load to populate the
options.  When the user clicks on an option, jquery asks a script to
have the remaining select menus have their options re-populated based
on distinct values for the rows that match the selected option(s).
The submit button is overwritten with jquery to ask a php script to
return a table for the rows that match all of the selected fields.

In order to prevent the select menu with a selected option from being
repopulated (thus losing the selection)  a class named "picked" is
added to the select menu in the .change function that also sends the
AJAX request to repopulate the others.

Would it be faster to simply have the rows loaded into a javascript
array or to use AJAX calls to PHP?  Here's the current code, which
works quite well for my current needs:

$(document).ready(function() {
$('#example').accordion();
$(':reset').bind('click',resetFunction);
function resetFunction(){
$('select').each(function(){
$(this).removeClass('picked');
});
}
$('select').change(function(){
$(this).addClass('picked');

var str = $('#form').serialize();
$.getJSON('pform.php',str,proc);

function proc(data){
//code to remove options and add new group of limited 
options
});

$('form').submit(function(evt){

var stri=$('#form').serialize();
$.get('psub.php',stri,ctab);
function ctab(ntable){
$('#tabContain').html(ntable);
}return false;
});

 });


[jQuery] Re: [validate] Attaching events to dynamically added fields

2009-01-08 Thread Rob

Hi Jörn,

I have been plugging away at this for a while now, with no luck.  I
set up a test page, and stripped it down to be as basic as possible
(it's much more basic than even the demos).  It is located here:
http://cymantix.net/validation

When you add new items, they don't appear to be validated along with
the other fields.  Could I trouble you to take a quick peek at my test
page?

Thanks,

Rob

On Jan 6, 2:34 am, "Jörn Zaefferer" 
wrote:
> The validation plugin binds various events to the form, handling everything
> that bubbles up from its form elements. So you don't have to add any event
> binding after adding new elements, just make sure the validation rules are
> present. If it isn't working, its probably a different issue.
>
> Jörn
>
> On Mon, Jan 5, 2009 at 11:26 PM, Rob  wrote:
>
> > Thanks Brian,
>
> > At the moment I'm using basically the simplest implementation of the
> > plugin.  I'm using inline rules, so I don't have to worry about the
> > brackets yet.  I do understand the event delegation, I had thought
> > that calling $("#form").validate() again after inserting the elements
> > would do the trick, but no such luck.
>
> > Rob
>
> > On Jan 5, 1:12 pm, brian  wrote:
> > > On Mon, Jan 5, 2009 at 2:40 PM, Rob  wrote:
>
> > > > Hi Jörn or anyone else familiar with this plugin,
>
> > > > First off, thanks for the great validation plugin.  I hope I do not
> > > > impose too much with this question.
>
> > > > I have a dynamic form with fields named using brackets ([]).
>
> > > See this note:
> >http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_compl...
>
> > > > Validation is working for fields that existed on the initial page
> > > > load, but when I add append the code for a new field, the validation
> > > > events are, of course, not attached to the new DOM elements.  What's
> > > > the best way to accomplish this?
>
> > > Make sure you understand event delegation. There's some info in the
> > > docs. Basically, you need to ensure that any newly-created elements
> > > are bound to event handlers. You can either bind them when they are
> > > added or bind the container and findthe specific element in your event
> > > handler by getting event.target.
>
> > > Though, I've no idea how to do this with the Validation plugin,
> > specifically.


[jQuery] Re: How to force processing of ColdFusion code when using .load

2009-01-08 Thread Rick Faircloth

Maybe the "cache: false" idea isn't working because the problem
isn't with any of the content involving the ajax function, it's
with content in the ajax success section:  just simple loading
of content from another page not involved in the ajax process.

Even with caching set to false the menu still doesn't change
properly until the entire page is refreshed (in IE...in FF3 it works fine)

???



> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Rick Faircloth
> Sent: Thursday, January 08, 2009 6:09 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
> .load
> 
> 
> Rats!  didn't work...
> 
> IE is putting the menu for the previous user
> back on the page and still not processing the conditional statements
> to change the menu.  Once a page refresh is performed, however, the
> menu shows up as it should.
> 
> I had tried setting no-cache on in the header of the page, too, but
> that didn't affect anything.
> 
> Any other ideas?
> 
> Rick
> 
> > -Original Message-
> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> > Behalf Of Josh Nathanson
> > Sent: Thursday, January 08, 2009 5:27 PM
> > To: jquery-en@googlegroups.com
> > Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
> > .load
> >
> >
> > Rick - set cache="false" in your ajax call.
> > $.ajax({
> > Cache: false,
> >   type: "POST",
> > etc.
> >
> > IE caches everything by default unless you tell it not to.
> >
> > Also you can do this once and all your ajax calls will not cache:
> >
> > $.ajaxSetup({ cache: false });
> >
> > Thereafter you won't have to have the cache: false parameter set for each
> > ajax call.
> >
> > -- Josh
> >
> >
> > -Original Message-
> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> > Behalf Of Rick Faircloth
> > Sent: Thursday, January 08, 2009 2:05 PM
> > To: jquery-en@googlegroups.com
> > Subject: [jQuery] How to force processing of ColdFusion code when using
> > .load
> >
> >
> > How can I force the processing of ColdFusion code in a menu
> > segment when I have some login and I replace the menu HTML.
> >
> > I had some conditional code like:
> >
> >  > session.announcements eq 1>
> >  > href="cfm/announcements.cfm">Announcements
> > 
> >
> >  > session.res_announcements eq 1>
> > RES
> > Announcements
> > 
> >
> > This code displays menu items only if the user has clearance
> > to access those sections in a site manager.
> >
> > The problem I have is the IE (seems to be working fine in FF3)
> > is not processing the CF code unless I do a full page refresh...then it
> > displays the menu appropriately.
> >
> > Here's the jQuery...any idea how to force IE to reprocess the CF, too?
> >
> >
> > > $.ajax({
> > > type: "POST",
> > > url:  "login/login_processor.cfm",
> > > dataType: "json",
> > > data: formval,
> > > success: function(response){
> > >
> > >   if (response.login == "Login Successful")
> > >  { $('#logstatus').empty().append("Log Out");
> > >$('#menu').hide();
> > >
> > $('#menu').load("includes/include_menu_index.cfm").show();
> > >   tb_remove() }
> 




[jQuery] Re: How to force processing of ColdFusion code when using .load

2009-01-08 Thread Rick Faircloth

Rats!  didn't work...

IE is putting the menu for the previous user
back on the page and still not processing the conditional statements
to change the menu.  Once a page refresh is performed, however, the
menu shows up as it should.

I had tried setting no-cache on in the header of the page, too, but
that didn't affect anything.

Any other ideas?

Rick

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Josh Nathanson
> Sent: Thursday, January 08, 2009 5:27 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
> .load
> 
> 
> Rick - set cache="false" in your ajax call.
> $.ajax({
> Cache: false,
> type: "POST",
>   etc.
> 
> IE caches everything by default unless you tell it not to.
> 
> Also you can do this once and all your ajax calls will not cache:
> 
> $.ajaxSetup({ cache: false });
> 
> Thereafter you won't have to have the cache: false parameter set for each
> ajax call.
> 
> -- Josh
> 
> 
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Rick Faircloth
> Sent: Thursday, January 08, 2009 2:05 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] How to force processing of ColdFusion code when using
> .load
> 
> 
> How can I force the processing of ColdFusion code in a menu
> segment when I have some login and I replace the menu HTML.
> 
> I had some conditional code like:
> 
>session.announcements eq 1>
>href="cfm/announcements.cfm">Announcements
>   
> 
>session.res_announcements eq 1>
>   RES
> Announcements
>   
> 
> This code displays menu items only if the user has clearance
> to access those sections in a site manager.
> 
> The problem I have is the IE (seems to be working fine in FF3)
> is not processing the CF code unless I do a full page refresh...then it
> displays the menu appropriately.
> 
> Here's the jQuery...any idea how to force IE to reprocess the CF, too?
> 
> 
> > $.ajax({
> >   type: "POST",
> >   url:  "login/login_processor.cfm",
> >   dataType: "json",
> >   data: formval,
> >   success: function(response){
> >
> > if (response.login == "Login Successful")
> >{ $('#logstatus').empty().append("Log Out");
> >  $('#menu').hide();
> >
> $('#menu').load("includes/include_menu_index.cfm").show();
> > tb_remove() }




[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Alexandre Plennevaux

Yeah, actually me too. I remember i used bits of javascript but could
never get good at it. It's only with jquery that i became convinced
that it was the right technology and my personal flash killer
technology. I definitely know much more about javascript than before,
when i simply gave up on it because crossbrowser issues made it a
no-go.
Personally, i'm a jack of all trades, half designer half coder, that's
why i value all of you guys' opinion , keep them coming !


On Thu, Jan 8, 2009 at 11:43 PM, Nikola  wrote:
>
> That's very true and in fact that's how I'm learning JavaScript
> myself.  jQuery is an awesome way to learn, it's smart, fun and
> powerful.


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Nikola

That's very true and in fact that's how I'm learning JavaScript
myself.  jQuery is an awesome way to learn, it's smart, fun and
powerful.


[jQuery] Re: how to select all first td's inside all in a table

2009-01-08 Thread Mauricio (Maujor) Samy Silva


$('tr > td') // match ALL td's that are children of a tr.

$('tr td:first-child') // match ONLY td's that are first-child of a tr - 
this is the selector Tijmen is asking for.


Regards,
Mauricio



I believe you have two options:



$('tr>td')



or



$('tr td:first-child')

i've never used first-child myself so i may understand it wrongly.Let me 
know !




[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Kean

Your audience are designers, they will pick up jQuery faster because
they think in CSS.

At what point do you teach them javascript?
When you teach them how to create plugins for jQuery.

I hope this helps.

On Jan 8, 2:13 pm, Nikola  wrote:
> Why not integrate the basic "JavaScript Fundamentals" in each jQuery
> lesson.  You could show some general examples and explain the
> rudimentary JavaScript principal (I'm thinking a 15 minute
> introduction...) then teach the jQuery and demonstrate how and why
> jQuery is the "write less, do more" JavaScript library..  This way,
> students get the gist of the JavaScript while learning jQuery. This
> may not be as desirable as learning jQuery on top of a strong
> JavaScript foundation but it can certainly help them to become
> stronger jQuery developers while giving them an introductory
> foundation in JavaScript principals.


[jQuery] Re: How to force processing of ColdFusion code when using .load

2009-01-08 Thread Josh Nathanson

Rick - set cache="false" in your ajax call.
$.ajax({
Cache: false,
  type: "POST",
etc.

IE caches everything by default unless you tell it not to.

Also you can do this once and all your ajax calls will not cache:

$.ajaxSetup({ cache: false });

Thereafter you won't have to have the cache: false parameter set for each
ajax call.

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Thursday, January 08, 2009 2:05 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] How to force processing of ColdFusion code when using
.load


How can I force the processing of ColdFusion code in a menu
segment when I have some login and I replace the menu HTML.

I had some conditional code like:


Announcements



RES
Announcements


This code displays menu items only if the user has clearance
to access those sections in a site manager.

The problem I have is the IE (seems to be working fine in FF3)
is not processing the CF code unless I do a full page refresh...then it
displays the menu appropriately.

Here's the jQuery...any idea how to force IE to reprocess the CF, too?


> $.ajax({
> type: "POST",
> url:  "login/login_processor.cfm",
> dataType: "json",
> data: formval,
> success: function(response){
> 
>   if (response.login == "Login Successful")
>  { $('#logstatus').empty().append("Log Out");
>$('#menu').hide();
>
$('#menu').load("includes/include_menu_index.cfm").show();
>   tb_remove() }



[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Nikola

Why not integrate the basic "JavaScript Fundamentals" in each jQuery
lesson.  You could show some general examples and explain the
rudimentary JavaScript principal (I'm thinking a 15 minute
introduction...) then teach the jQuery and demonstrate how and why
jQuery is the "write less, do more" JavaScript library..  This way,
students get the gist of the JavaScript while learning jQuery. This
may not be as desirable as learning jQuery on top of a strong
JavaScript foundation but it can certainly help them to become
stronger jQuery developers while giving them an introductory
foundation in JavaScript principals.


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Eric Garside

To be honest, I'm going to have to go against the party line here.
jQuery *is* javascript in this day and age, and I think that's what
matters more than anything. I'm a straight programmer who isn't
blessed with a skill at graphic design. And if I could work with a
gDesigner who knew how to use jQuery, that would be the best thing
ever.

If you were teaching javascript to budding web programmers, I would
agree with the other posters and suggest teaching jQuery later on. But
if you're working with designers first and foremost? Teaching them
jQuery would be, I think, a big leg up.

My suggestion is to make the focus of the class two fold. First, how
to use the very basics of jQuery. Using selectors, changing
attributes, modifying css, creating effects, etc. Then, as a final
project sort of affair, have them design, build, and test a jQuery
plugin. If they can get those two things down, they'll be picking up a
lot of basic javascript skill as they go.

On Jan 8, 5:03 pm, "Alexandre Plennevaux" 
wrote:
> Thank you all guys, these are  very useful clarifications to me !
>
> On Thu, Jan 8, 2009 at 10:46 PM, Andy Matthews  
> wrote:
>
> > I'd look at teaching jQuery as a 2nd level course. Once you've covered at
> > least the basics of JavaScript, then you can get into jQuery.
>
> > -Original Message-
> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> > Behalf Of Klaus Hartl
> > Sent: Thursday, January 08, 2009 3:38 PM
> > To: jQuery (English)
> > Subject: [jQuery] Re: teaching jquery instead of javascript ?
>
> > jQuery is JavaScript, and at some point you need to know JavaScript.
>
> > I would never hire anyone who claims to know jQuery but not JavaScript.
>
> > my 0.02$
>
> > --Klaus
>
> > On 8 Jan., 22:23, pixeline  wrote:
> >> Hello mates,
>
> >> I will start to teach web usability to freshly graduated youngsters in
> >> a graphic design school  _ web dept, web dept.
> >> The Board recently proposed me to also take over javascript. Now i
> >> intend to them i'm not literate enough in javascript to actually teach
> >> it. But i proposed instead to teach jquery, with the main argument
> >> being: it's a 3-year programme, it's not with 2 hours a week that most
> >> kids will get professionnal level javascript skills. Teaching jquery
> >> on the other hand, may give these junior designers a useful knowledge
> >> and discover scripting from a starting point that they understand _
> >> not the (with all due respect:) ) geek's "code is poetry" point of
> >> view, but from the "in your face" designer point of view.
>
> >> I would like to know what you guys think of my argument: is teaching
> >> the usage of a specific javascript framework relevant to the business
> >> world? Would you hire a freshman that cannot program pure javascript
> >> but can pretty much achieve the same result, in less time, with
> >> jquery?
>
> >> Looking forward to reading your thoughts !
>
> >> Cheers,
>
> >> Alexandre


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Nikola

Why not include basic "JavaScript Fundamentals" in each jQuery
lesson.  Show some general examples and explain the general JavaScript
principal of the lesson works (I'm thinking a 15 minute
introduction...) then teach the jQuery and illustrate how and why
jQuery is the "write less, do more" JavaScript library..  That way
students get the gist of the JavaScript while learning the jQuery.
This may not be as desirable as learning jQuery on top of a strong
JavaScript foundation but it can help them to become stronger jQuery
developers.


[jQuery] Re: how to select all first td's inside all in a table

2009-01-08 Thread Alexandre Plennevaux

I believe you have two options:

$('tr>td')

or

$('tr td:first-child')

i've never used first-child myself so i may understand it wrongly.Let me know !

On Thu, Jan 8, 2009 at 10:58 PM, Tijmen Smit  wrote:
>
> I have a table that contains several , all of them look like
> this.
>
>
>20-04
>459
>559
>659
>439
>519
>599
>424
>489
>554
>
>
>27-04
>506
>606
>706
>486
>566
>646
>471
>536
>601
>
>
>
> One of the things that I would like to do is add the class "date" to
> the first td that exists after a .
>
> I came up with this -> $("#prijslijst-appartement tr td:eq
> (0)").addClass("date"); , but that doesn't really do what I thought It
> would. It only adds the date class to one td, and it ignores all the
> other  in the table. What I was hoping it would do is finding all
> , and then add the date class to the first  in all the  in
> the entire table.
>
> You can see the example here -> http://tijmensmit.com/dev/td/prijslijst.html.
> The one with the date class on it has the pink border around it.
>
> Its not only the first  which I should target, the 3th, 6th and
> 9th  within each  should also be given a different class.
>
> What would be the best way to do this, and to make sure it looks in
> all  in the entire table, and not stops after the first one?
>
> Thanks,
> Tijmen


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Alexandre Plennevaux

Thanks seasoup, that's what i intended . Besides, the few hours they
will get to learn javascript may not be enough to give them a strong
basis. But i'm discovering the school, so i might be wrong. I'll
reconsider this next year. The option to teach jquery as a second
level course makes definitely a lot of sense though.

On Thu, Jan 8, 2009 at 11:02 PM, seasoup  wrote:
>
> I think that a designer who knows jQuery is ahead of those that do
> not.  I would love to work with a designer who could put together the
> rudimentary functionality of a website with jQuery. If designers can
> pick up jQuery that would be great, most designers do not bother to
> learn javascript.  There are exceptions, but generally it's just not
> the way they think.
>
> On the other hand, i would not tell the school that you will not teach
> javascript, you wont get the job.  Tell them you will introduce
> javascript through the jQuery framework instead.
>
> On Jan 8, 1:46 pm, "Andy Matthews"  wrote:
>> I'd look at teaching jQuery as a 2nd level course. Once you've covered at
>> least the basics of JavaScript, then you can get into jQuery.
>>
>> -Original Message-
>> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>>
>> Behalf Of Klaus Hartl
>> Sent: Thursday, January 08, 2009 3:38 PM
>> To: jQuery (English)
>> Subject: [jQuery] Re: teaching jquery instead of javascript ?
>>
>> jQuery is JavaScript, and at some point you need to know JavaScript.
>>
>> I would never hire anyone who claims to know jQuery but not JavaScript.
>>
>> my 0.02$
>>
>> --Klaus
>>
>> On 8 Jan., 22:23, pixeline  wrote:
>> > Hello mates,
>>
>> > I will start to teach web usability to freshly graduated youngsters in
>> > a graphic design school  _ web dept, web dept.
>> > The Board recently proposed me to also take over javascript. Now i
>> > intend to them i'm not literate enough in javascript to actually teach
>> > it. But i proposed instead to teach jquery, with the main argument
>> > being: it's a 3-year programme, it's not with 2 hours a week that most
>> > kids will get professionnal level javascript skills. Teaching jquery
>> > on the other hand, may give these junior designers a useful knowledge
>> > and discover scripting from a starting point that they understand _
>> > not the (with all due respect:) ) geek's "code is poetry" point of
>> > view, but from the "in your face" designer point of view.
>>
>> > I would like to know what you guys think of my argument: is teaching
>> > the usage of a specific javascript framework relevant to the business
>> > world? Would you hire a freshman that cannot program pure javascript
>> > but can pretty much achieve the same result, in less time, with
>> > jquery?
>>
>> > Looking forward to reading your thoughts !
>>
>> > Cheers,
>>
>> > Alexandre


[jQuery] How to force processing of ColdFusion code when using .load

2009-01-08 Thread Rick Faircloth

How can I force the processing of ColdFusion code in a menu
segment when I have some login and I replace the menu HTML.

I had some conditional code like:


Announcements



RES 
Announcements


This code displays menu items only if the user has clearance
to access those sections in a site manager.

The problem I have is the IE (seems to be working fine in FF3)
is not processing the CF code unless I do a full page refresh...then it
displays the menu appropriately.

Here's the jQuery...any idea how to force IE to reprocess the CF, too?


> $.ajax({
> type: "POST",
> url:  "login/login_processor.cfm",
> dataType: "json",
> data: formval,
> success: function(response){
> 
>   if (response.login == "Login Successful")
>  { $('#logstatus').empty().append("Log Out");
>$('#menu').hide();
>$('#menu').load("includes/include_menu_index.cfm").show();
>   tb_remove() }



[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Alexandre Plennevaux

Thank you all guys, these are  very useful clarifications to me !

On Thu, Jan 8, 2009 at 10:46 PM, Andy Matthews  wrote:
>
> I'd look at teaching jQuery as a 2nd level course. Once you've covered at
> least the basics of JavaScript, then you can get into jQuery.
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Klaus Hartl
> Sent: Thursday, January 08, 2009 3:38 PM
> To: jQuery (English)
> Subject: [jQuery] Re: teaching jquery instead of javascript ?
>
>
> jQuery is JavaScript, and at some point you need to know JavaScript.
>
> I would never hire anyone who claims to know jQuery but not JavaScript.
>
> my 0.02$
>
> --Klaus
>
> On 8 Jan., 22:23, pixeline  wrote:
>> Hello mates,
>>
>> I will start to teach web usability to freshly graduated youngsters in
>> a graphic design school  _ web dept, web dept.
>> The Board recently proposed me to also take over javascript. Now i
>> intend to them i'm not literate enough in javascript to actually teach
>> it. But i proposed instead to teach jquery, with the main argument
>> being: it's a 3-year programme, it's not with 2 hours a week that most
>> kids will get professionnal level javascript skills. Teaching jquery
>> on the other hand, may give these junior designers a useful knowledge
>> and discover scripting from a starting point that they understand _
>> not the (with all due respect:) ) geek's "code is poetry" point of
>> view, but from the "in your face" designer point of view.
>>
>> I would like to know what you guys think of my argument: is teaching
>> the usage of a specific javascript framework relevant to the business
>> world? Would you hire a freshman that cannot program pure javascript
>> but can pretty much achieve the same result, in less time, with
>> jquery?
>>
>> Looking forward to reading your thoughts !
>>
>> Cheers,
>>
>> Alexandre
>
>
>


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread seasoup

I think that a designer who knows jQuery is ahead of those that do
not.  I would love to work with a designer who could put together the
rudimentary functionality of a website with jQuery. If designers can
pick up jQuery that would be great, most designers do not bother to
learn javascript.  There are exceptions, but generally it's just not
the way they think.

On the other hand, i would not tell the school that you will not teach
javascript, you wont get the job.  Tell them you will introduce
javascript through the jQuery framework instead.

On Jan 8, 1:46 pm, "Andy Matthews"  wrote:
> I'd look at teaching jQuery as a 2nd level course. Once you've covered at
> least the basics of JavaScript, then you can get into jQuery.
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>
> Behalf Of Klaus Hartl
> Sent: Thursday, January 08, 2009 3:38 PM
> To: jQuery (English)
> Subject: [jQuery] Re: teaching jquery instead of javascript ?
>
> jQuery is JavaScript, and at some point you need to know JavaScript.
>
> I would never hire anyone who claims to know jQuery but not JavaScript.
>
> my 0.02$
>
> --Klaus
>
> On 8 Jan., 22:23, pixeline  wrote:
> > Hello mates,
>
> > I will start to teach web usability to freshly graduated youngsters in
> > a graphic design school  _ web dept, web dept.
> > The Board recently proposed me to also take over javascript. Now i
> > intend to them i'm not literate enough in javascript to actually teach
> > it. But i proposed instead to teach jquery, with the main argument
> > being: it's a 3-year programme, it's not with 2 hours a week that most
> > kids will get professionnal level javascript skills. Teaching jquery
> > on the other hand, may give these junior designers a useful knowledge
> > and discover scripting from a starting point that they understand _
> > not the (with all due respect:) ) geek's "code is poetry" point of
> > view, but from the "in your face" designer point of view.
>
> > I would like to know what you guys think of my argument: is teaching
> > the usage of a specific javascript framework relevant to the business
> > world? Would you hire a freshman that cannot program pure javascript
> > but can pretty much achieve the same result, in less time, with
> > jquery?
>
> > Looking forward to reading your thoughts !
>
> > Cheers,
>
> > Alexandre


[jQuery] how to select all first td's inside all in a table

2009-01-08 Thread Tijmen Smit

I have a table that contains several , all of them look like
this.


20-04
459
559
659
439
519
599
424
489
554


27-04
506
606
706
486
566
646
471
536
601



One of the things that I would like to do is add the class "date" to
the first td that exists after a .

I came up with this -> $("#prijslijst-appartement tr td:eq
(0)").addClass("date"); , but that doesn't really do what I thought It
would. It only adds the date class to one td, and it ignores all the
other  in the table. What I was hoping it would do is finding all
, and then add the date class to the first  in all the  in
the entire table.

You can see the example here -> http://tijmensmit.com/dev/td/prijslijst.html.
The one with the date class on it has the pink border around it.

Its not only the first  which I should target, the 3th, 6th and
9th  within each  should also be given a different class.

What would be the best way to do this, and to make sure it looks in
all  in the entire table, and not stops after the first one?

Thanks,
Tijmen


[jQuery] Re: if statement testing for null value

2009-01-08 Thread Michael Geary

Actually, $('#field').val() is an *empty string* if a form field is present
but empty. So the problem is the test is too type-specific (and testing for
the wrong type) already.

You could use != '', but it's cleaner to simply not do any comparison. Code
it like this:

if(
$('#equipmentNumber').val()  &&
$('#description').val()  &&
$('#type').val()  &&
$('#department')  &&
$('#location').val()
) {
$('#submit').attr( 'disabled', false );
}

Or, if you wanted to explicitly set the disabled attribute in both the true
and false case, here's an interesting way to code it:

$('#submit').attr( 'disabled', !(
$('#equipmentNumber').val()  &&
$('#description').val()  &&
$('#type').val()  &&
$('#department')  &&
$('#location').val()
) );

-Mike

> From: Alexandre Plennevaux
> 
> try using !== instead of !=  as this checks also against the 
> variable type.
> 
> you can also try
> 
> if ( typeof myvar ==='undefined'){
> //error
> }

> > From: Chuk 
> >
> > Hi.  I have a form with a disabled submit button when the page is 
> > loaded.  I'm trying to activate that submit button only 
> when two text 
> > fields(ids="equipmentNumber" and "description") and three 
> select boxes 
> > (ids="type","department"," and "location") contain a value. 
>  Here is 
> > my current code:
> >
> > if ($('#equipmentNumber').val() != null && 
> $('#description').val() != 
> > null && $('#type').val() != null && $('#department') != null && $
> > ('#location').val() != null)
> > {
> >$('#submit').attr("disabled",false);
> > }
> >
> > However, this condition is always true...even if each field 
> is blank.
> > Does anyone see right off where I've messed up?
> 



[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Andy Matthews

I'd look at teaching jQuery as a 2nd level course. Once you've covered at
least the basics of JavaScript, then you can get into jQuery. 

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Klaus Hartl
Sent: Thursday, January 08, 2009 3:38 PM
To: jQuery (English)
Subject: [jQuery] Re: teaching jquery instead of javascript ?


jQuery is JavaScript, and at some point you need to know JavaScript.

I would never hire anyone who claims to know jQuery but not JavaScript.

my 0.02$

--Klaus

On 8 Jan., 22:23, pixeline  wrote:
> Hello mates,
>
> I will start to teach web usability to freshly graduated youngsters in 
> a graphic design school  _ web dept, web dept.
> The Board recently proposed me to also take over javascript. Now i 
> intend to them i'm not literate enough in javascript to actually teach 
> it. But i proposed instead to teach jquery, with the main argument
> being: it's a 3-year programme, it's not with 2 hours a week that most 
> kids will get professionnal level javascript skills. Teaching jquery 
> on the other hand, may give these junior designers a useful knowledge 
> and discover scripting from a starting point that they understand _ 
> not the (with all due respect:) ) geek's "code is poetry" point of 
> view, but from the "in your face" designer point of view.
>
> I would like to know what you guys think of my argument: is teaching 
> the usage of a specific javascript framework relevant to the business 
> world? Would you hire a freshman that cannot program pure javascript 
> but can pretty much achieve the same result, in less time, with 
> jquery?
>
> Looking forward to reading your thoughts !
>
> Cheers,
>
> Alexandre




[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread pete higgins

I'm inclined to agree. Having a good foundation of JavaScript before
adopting any library will do these students a much greater service
than simply teaching them an API that is already relatively easy to
learn. Teach them JS, and in places where is really matters, show them
how JQ (or the other libraries, no need to be biased in an academic
setting right?) supplement JS and/or the DOM to work around the pain
points you have shown them.

Regards,
Peter Hggins

On Thu, Jan 8, 2009 at 4:38 PM, Klaus Hartl  wrote:
>
> jQuery is JavaScript, and at some point you need to know JavaScript.
>
> I would never hire anyone who claims to know jQuery but not
> JavaScript.
>
> my 0.02$
>
> --Klaus
>
> On 8 Jan., 22:23, pixeline  wrote:
>> Hello mates,
>>
>> I will start to teach web usability to freshly graduated youngsters in
>> a graphic design school  _ web dept, web dept.
>> The Board recently proposed me to also take over javascript. Now i
>> intend to them i'm not literate enough in javascript to actually teach
>> it. But i proposed instead to teach jquery, with the main argument
>> being: it's a 3-year programme, it's not with 2 hours a week that most
>> kids will get professionnal level javascript skills. Teaching jquery
>> on the other hand, may give these junior designers a useful knowledge
>> and discover scripting from a starting point that they understand _
>> not the (with all due respect:) ) geek's "code is poetry" point of
>> view, but from the "in your face" designer point of view.
>>
>> I would like to know what you guys think of my argument: is teaching
>> the usage of a specific javascript framework relevant to the business
>> world? Would you hire a freshman that cannot program pure javascript
>> but can pretty much achieve the same result, in less time, with
>> jquery?
>>
>> Looking forward to reading your thoughts !
>>
>> Cheers,
>>
>> Alexandre


[jQuery] Re: (smooth) scroll to anchor but...

2009-01-08 Thread Ariel Flesler

@Karl

$('html, body') is a simple, yet bad, approach.
It's one or the other not both.
Browsers like Opera that react to both elements, can go mad when doing
this.

Cheers

--
Ariel Flesler
http://flesler.blogspot.com

On Jan 8, 1:20 pm, Karl Swedberg  wrote:
> Hi there,
>
> Here's a quick and dirty way to do it, off the top of my head. Totally  
> untested, but should get you started, at least:
>
> // determine left and top position of img
>
> var imgLeft = $('#yourImage').offset().left;
> var imgTop = $('#yourImage').offset().top;
>
> // on click, grab the coords attribute of the area and add them to the  
> img position for animating
>
> $('area').click(function() {
>    var toArea = $(this).attr('href');
>    var coords = $(toArea).attr('coords').split(',');
>    $('html, body').animate({
>      scrollLeft: imgLeft + coords[0],
>      scrollTop: imgTop + coords[1],
>    }, 400);
>
> });
>
> --Karl
>
> 
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Jan 7, 2009, at 5:14 PM, schnuck wrote:
>
>
>
> > ...what if the areas i need to scroll to are defined as anchors in
> > html  elements on top of a large inline image? and the areas that
> > trigger the links are image map areas too. clicking on the image map
> > areas scroll from one area to another. ideally not using absolute
> > positioning, but with html anchors and their IDs.
>
> > i tried modifying this technique here for no avail:
>
> >http://www.learningjquery.com/2007/10/improved-animated-scrolling-scr...
>
> > and this one here:
>
> >http://plugins.jquery.com/project/scrollto
>
> > any help appreciated - thanks!
>
>


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Klaus Hartl

jQuery is JavaScript, and at some point you need to know JavaScript.

I would never hire anyone who claims to know jQuery but not
JavaScript.

my 0.02$

--Klaus

On 8 Jan., 22:23, pixeline  wrote:
> Hello mates,
>
> I will start to teach web usability to freshly graduated youngsters in
> a graphic design school  _ web dept, web dept.
> The Board recently proposed me to also take over javascript. Now i
> intend to them i'm not literate enough in javascript to actually teach
> it. But i proposed instead to teach jquery, with the main argument
> being: it's a 3-year programme, it's not with 2 hours a week that most
> kids will get professionnal level javascript skills. Teaching jquery
> on the other hand, may give these junior designers a useful knowledge
> and discover scripting from a starting point that they understand _
> not the (with all due respect:) ) geek's "code is poetry" point of
> view, but from the "in your face" designer point of view.
>
> I would like to know what you guys think of my argument: is teaching
> the usage of a specific javascript framework relevant to the business
> world? Would you hire a freshman that cannot program pure javascript
> but can pretty much achieve the same result, in less time, with
> jquery?
>
> Looking forward to reading your thoughts !
>
> Cheers,
>
> Alexandre


[jQuery] Re: if statement testing for null value

2009-01-08 Thread Alexandre Plennevaux

try using !== instead of !=  as this checks also against the variable type.

you can also try

if ( typeof myvar ==='undefined'){
//error
}



On Thu, Jan 8, 2009 at 10:25 PM, Chuk  wrote:
>
> Hi.  I have a form with a disabled submit button when the page is
> loaded.  I'm trying to activate that submit button only when two text
> fields(ids="equipmentNumber" and "description") and three select boxes
> (ids="type","department"," and "location") contain a value.  Here is
> my current code:
>
> if ($('#equipmentNumber').val() != null && $('#description').val() !=
> null && $('#type').val() != null && $('#department') != null && $
> ('#location').val() != null)
> {
>$('#submit').attr("disabled",false);
> }
>
> However, this condition is always true...even if each field is blank.
> Does anyone see right off where I've messed up?


[jQuery] if statement testing for null value

2009-01-08 Thread Chuk

Hi.  I have a form with a disabled submit button when the page is
loaded.  I'm trying to activate that submit button only when two text
fields(ids="equipmentNumber" and "description") and three select boxes
(ids="type","department"," and "location") contain a value.  Here is
my current code:

if ($('#equipmentNumber').val() != null && $('#description').val() !=
null && $('#type').val() != null && $('#department') != null && $
('#location').val() != null)
{
$('#submit').attr("disabled",false);
}

However, this condition is always true...even if each field is blank.
Does anyone see right off where I've messed up?


[jQuery] [OT] teaching jquery instead of javascript ?

2009-01-08 Thread pixeline

Hello mates,

I will start to teach web usability to freshly graduated youngsters in
a graphic design school  _ web dept, web dept.
The Board recently proposed me to also take over javascript. Now i
intend to them i'm not literate enough in javascript to actually teach
it. But i proposed instead to teach jquery, with the main argument
being: it's a 3-year programme, it's not with 2 hours a week that most
kids will get professionnal level javascript skills. Teaching jquery
on the other hand, may give these junior designers a useful knowledge
and discover scripting from a starting point that they understand _
not the (with all due respect:) ) geek's "code is poetry" point of
view, but from the "in your face" designer point of view.

I would like to know what you guys think of my argument: is teaching
the usage of a specific javascript framework relevant to the business
world? Would you hire a freshman that cannot program pure javascript
but can pretty much achieve the same result, in less time, with
jquery?

Looking forward to reading your thoughts !


Cheers,

Alexandre


[jQuery] Re: Trouble refreshing div with .load

2009-01-08 Thread Rick Faircloth

Anyone have any ideas on this?

> 
> I'm using the following code to refresh a menu
> based on a user's access privileges.  The login
> is via a modal window.
> 
> $.ajax({
> type: "POST",
> url:  "login/login_processor.cfm",
> dataType: "json",
> data: formval,
> success: function(response){
> 
>   if (response.login == "Login Successful")
>  { $('#logstatus').empty().append("Log Out");
>$('#menu').hide();
>$('#menu').load("includes/include_menu_index.cfm").show();
>   tb_remove() }
> 
> It's performing property in FF3, but IE6 and IE7
> aren't refreshing the #menu.  I have to refresh the
> page manually to get the menu to display correct items.
> 
> Is there some way I can rewrite this part:
> 
> $('#menu').hide();
> $('#menu').load("includes/include_menu_index.cfm").show();
> 
> or should that be sufficient.
> 
> Thanks,
> 
> Rick
> 
> 




[jQuery] Re: Validation: Which and why...

2009-01-08 Thread Nikola

I'm thinking now that I'll use jQuery validation methods from the
start which can make the form more interactive and interesting.  If
the form validates within jQuery then I'll pass it to my php
validation method.  In this case, I'll use to php to re-validate the
form under stricter criteria and employ a "honeypot" in php, an
invisible field that usually only a bot would fill out.

Why not just use php validation, though, and echo jQuery
from within my php?  I suppose the answer would be that using only
jQuery validation form start will be much faster and more "fun".  Once
the form validates and is ready to submit it's passed along to the php
validation which is a bit slower but is secure.


[jQuery] Re: Validation: Which and why...

2009-01-08 Thread Nikola

I'm thinking now that I'll use jQuery validation methods from the
start which can make the form more interactive and interesting.  If
the form validates within jQuery then I'll pass it to my php
validation method.  In this case, I'll use to php to re-validate the
form under stricter criteria and employ a "honeypot" in php, an
invisible field that usually only a bot would fill out.

Why wouldn't just use php validation, though, and echo some jQuery
from within my php?  I suppose the answer would be that using only
jQuery validation form start will be much faster and more "fun".  Once
the form validates and is ready to submit it's passed along to the php
validation which is a bit slower but is secure.


[jQuery] Re: display:block with jquery

2009-01-08 Thread Mauricio (Maujor) Samy Silva


display block is a CSS declaration, so use the css() method:

$('element').css('display', 'block');




how can i add display block to an element with jquery


[jQuery] Re: Highlighting the first element in multiple DIVS

2009-01-08 Thread Mauricio (Maujor) Samy Silva


Hi Martin,

Sintax is:  $('selector', [context])

When you set the optional parameter context for a jQuery selector
you are saying: "Match all 'selector' against the contents of context".

The default context is HTML element.

Please go to and open the tab "Examples": 
http://docs.jquery.com/Core/jQuery#expressioncontext




Hi Mauricio,

...

One question: I don't quite
understand the bit where it says "$('img:eq(0)', this)". 
Best regards,

Martin


[jQuery] Re: Tutorials or examples of jQuery and ColdFusion?

2009-01-08 Thread Rick Faircloth

> use "returnFormat=json" in your
> cffunction in CF8,

That's certainly easier than having to keep up with another CFC.

Thanks!

Rick

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Josh Nathanson
> Sent: Thursday, January 08, 2009 2:21 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: Tutorials or examples of jQuery and ColdFusion?
> 
> 
> JSON is never "necessary" per se, but it's such a nice and lightweight
> method of passing data around that it is becoming the de facto standard for
> ajax applications.
> 
> I haven't tried it, but I think if you use "returnFormat=json" in your
> cffunction in CF8, this accomplishes the same thing that cfjson.cfc is doing
> - convert any deep structures into a json string.
> 
> -- Josh
> 
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Rick Faircloth
> Sent: Thursday, January 08, 2009 10:45 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: Tutorials or examples of jQuery and ColdFusion?
> 
> 
> Thanks for the tip, Josh.
> 
> As a matter of fact, that's the tutorial that I modified
> to create a modal window, ajax-based login I just finished.
> 
> It uses cfjson.cfc.  Part of what I was wondering is if cfjson.cfc
> is still required or the recommended approach to CF and ajax in light
> of CF 8's built-in ajax functionality.
> 
> I also have questions about when JSON is necessary, etc., too.
> 
> I'm just trying to get more of a general education about CF and ajax.
> 
> Rick
> 
> > -Original Message-
> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Josh Nathanson
> > Sent: Thursday, January 08, 2009 1:18 PM
> > To: jquery-en@googlegroups.com
> > Subject: [jQuery] Re: Tutorials or examples of jQuery and ColdFusion?
> >
> >
> > Rick - if you go to the jQuery site, and look under Tutorials, there is an
> > example there.  It's not super detailed but it should give you some
> insight.
> >
> > -- Josh
> >
> > -Original Message-
> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> > Behalf Of Rick Faircloth
> > Sent: Thursday, January 08, 2009 9:45 AM
> > To: jquery-en@googlegroups.com
> > Subject: [jQuery] Tutorials or examples of jQuery and ColdFusion?
> >
> >
> 




[jQuery] Re: Highlighting the first element in multiple DIVS

2009-01-08 Thread Martynas Brijunas

Hi Ricardo,

> (sorry for being so meddlesome)

not at all! Thank you for your suggestions, especially about getting
rid of the images and using coloured anchors instead. I will try this
out this weekend.

Best regards,
Martin


[jQuery] Re: Highlighting the first element in multiple DIVS

2009-01-08 Thread Martynas Brijunas

Hi Mauricio,

> Let's loop the div.description using the each() method.
>
>   $('.description') .each(function(){
>   $('img:eq(0)', this).addClass('icon_selected');
>   });

thank you very much. Your suggestion with .each works very well. This
is what I have ended up with (see below). One question: I don't quite
understand the bit where it says "$('img:eq(0)', this)". Is that the
multiple selectors syntax (http://docs.jquery.com/Selectors/
multiple#selector1selector2selectorN)? Or is this syntax to do with
the .each statement? Sorry if this is a lame question, I am an
absolute beginner.

$("div.description").each(function() {
$("a.colour:first img.icon", this).addClass("icon_selected");
$("a.size:first img.icon", this).addClass("icon_selected");
});

Best regards,
Martin


[jQuery] Re: Correct way using Jquery

2009-01-08 Thread Josh Nathanson

Yeah...it's a calendar with variable display - if someone displays 12 months
and each day has three event handlers (click, mouseover, mouseout) you're up
to 1000 pretty quickly.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Eric Garside
Sent: Thursday, January 08, 2009 11:32 AM
To: jQuery (English)
Subject: [jQuery] Re: Correct way using Jquery


1000ish items? You're really putting something through it's paces. :P

On Jan 8, 2:07 pm, "Josh Nathanson"  wrote:
> I've run up against this event binding limit.  If you have 1000 or so DOM
> items to bind to event handlers, you will see the slowness, and/or get ye
> olde "you have a long running script" browser alert.
>
> One way around it is to use event delegation, but this has its plusses and
> minuses as well.  In my case using inline events in this limited case
worked
> fine and I haven't had to revisit the issue since then.
>
> -- Josh
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>
> Behalf Of Eric Garside
> Sent: Thursday, January 08, 2009 10:11 AM
> To: jQuery (English)
> Subject: [jQuery] Re: Correct way using Jquery
>
> For the sake of maintainability and reuseability, inline events are a
> poor decision if you're using a robust library such as jQuery. A lot
> of the jQuery source code is aimed at traversing, manipulating, and
> hooking the DOM events. Using jQuery and inline events is like buying
> a ferrari and hooking it up to a horse to pull it.
>
> Do you have an example of a large, complex page where jQuery is too
> slow to list inline events? I've never even heard such an indictment
> against event handling outside of the markup.
>
> On Jan 8, 12:26 pm, Matt Kruse  wrote:
> > On Jan 8, 9:17 am, Eric Garside  wrote:
>
> > > And, never, ever use inline events.
>
> > I disagree. I use them all the time, because it's too slow to attach
> > them after page load using jQuery, especially on large, complex pages.
>
> > Matt Kruse



[jQuery] Re: Correct way using Jquery

2009-01-08 Thread Matt Kruse

On Jan 8, 1:32 pm, Eric Garside  wrote:
> 1000ish items? You're really putting something through it's paces. :P

I find it mostly when building rich UI webapps. Especially when
dealing with IE.

I did much experimentation and found that in many cases IE performed
faster when using inline event handlers even compared to delegation
(and certainly compared to attaching events to each element). And for
me, performance is second in importance only to functional
correctness. I don't care about delivering a few extra kb's of content
or generating the inline handlers server-side.

One thing I've had to push against with developers using jQuery is
that once you have this tool, you start to look for ways to solve
every problem with it. When you have a hammer, everything looks like a
nail. But IMO, there are many cases where jQuery is not needed at all,
and trying to solve every problem "the jQuery way" is a mistake. Use
it only when it makes things better (which is quite often, for me).

Matt Kruse


[jQuery] display:block with jquery

2009-01-08 Thread led

how can i add display block to an element with jquery


[jQuery] Re: Select Element CSS Attributes

2009-01-08 Thread _cam_


Yes, I'm using the script at 
http://www.dillerdesign.com/experiment/DD_belatedPNG/.

Rather than hard coding the class "pngFix" to the elements, I want to
add them on the fly.

Thank you.


On Jan 7, 8:23 pm, Ricardo Tomasi  wrote:
> This seems to work.
>
> $('elements').filter(function(){
>    return $(this).css('backgroundImage').indexOf('.png')+1;
>
> });
>
> Out of curiosity, are you trying to deal with png transparency in IE6?
>
> On Jan 7, 4:29 pm, _cam_  wrote:
>
> > How would youselectelements that haveCSSbackground images ending
> > with .png? And then add a class.


[jQuery] Re: Correct way using Jquery

2009-01-08 Thread Eric Garside

1000ish items? You're really putting something through it's paces. :P

On Jan 8, 2:07 pm, "Josh Nathanson"  wrote:
> I've run up against this event binding limit.  If you have 1000 or so DOM
> items to bind to event handlers, you will see the slowness, and/or get ye
> olde "you have a long running script" browser alert.
>
> One way around it is to use event delegation, but this has its plusses and
> minuses as well.  In my case using inline events in this limited case worked
> fine and I haven't had to revisit the issue since then.
>
> -- Josh
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>
> Behalf Of Eric Garside
> Sent: Thursday, January 08, 2009 10:11 AM
> To: jQuery (English)
> Subject: [jQuery] Re: Correct way using Jquery
>
> For the sake of maintainability and reuseability, inline events are a
> poor decision if you're using a robust library such as jQuery. A lot
> of the jQuery source code is aimed at traversing, manipulating, and
> hooking the DOM events. Using jQuery and inline events is like buying
> a ferrari and hooking it up to a horse to pull it.
>
> Do you have an example of a large, complex page where jQuery is too
> slow to list inline events? I've never even heard such an indictment
> against event handling outside of the markup.
>
> On Jan 8, 12:26 pm, Matt Kruse  wrote:
> > On Jan 8, 9:17 am, Eric Garside  wrote:
>
> > > And, never, ever use inline events.
>
> > I disagree. I use them all the time, because it's too slow to attach
> > them after page load using jQuery, especially on large, complex pages.
>
> > Matt Kruse


[jQuery] Re: showErrors and errorPlacement [validation]

2009-01-08 Thread morraine

Hello ive hackeds away and got a solution to get it to work :

$(document).ready(function() {

jQuery.validator.setDefaults({
errorPlacement: function(error, element) {
error.appendTo( 
element.siblings('span.valmessage') )//,
}
});

var validator = $("#loginform").validate({
rules: {
f_email0: {required: true, email: true},
f_password0: {required: true, minlength: 6}
},
messages: {
f_email0: {
required: "Enter your email address",
email: "Enter a valid email address"
//remote: jQuery.format("{0} is already in use")
},
f_password0: {
required: "Provide a password",
rangelength: jQuery.format("Enter at least {0} 
characters")
}
},

showErrors: function(errorMap, errorList) {
var errors = this.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field below. It has been
highlighted'
: 'You missed  ' + errors + ' fields 
below.
They have been highlighted';
$("div#formerror1 span").html(message);
$("div#formerror1").slideDown();
} else {
$("div#formerror1").slideUp();
}
this.defaultShowErrors();
}

});

});

ASD the showErrors updates the error count on every event i put an
errorPlacement rule as a default and called this from the ShowErrors
option, this works well i think its not a hack but seams to be correct
way of doing this, if you know of a better way please let me know.
Thanks

On Jan 8, 7:04 pm, morraine  wrote:
> Hi jörn thanks for the reply;
>
> OK yes i have seen than demo and ive played about with it as well but
> it seems to only update the amount when you click the submit button. I
> want it to update on every validation event (keyup, focus etc) so
> that when you enter the correct information for 5 incorrect fields it
> will update as you go with each field validation. and then if all the
> fields have been entered correctly then it will hide all with out
> hitting the submit button again. then  the user can hit the submit
> button.
>
> How can i do this?
>
> Thanks again for you help.
>
> On Jan 8, 6:43 pm, "Jörn Zaefferer" 
> wrote:
>
>
>
> > Take a look at this demo:http://jquery.bassistance.de/validate/demo/marketo/
> > The interesting part is here:
>
> >         $("form").bind("invalid-form.validate", function(e, validator) {
> >                 var errors = validator.numberOfInvalids();
> >                 if (errors) {
> >                         var message = errors == 1
> >                                 ? 'You missed 1 field. It has been 
> > highlighted below'
> >                                 : 'You missed ' + errors + ' fields.  They 
> > have been highlighted below';
> >                         $("div.error span").html(message);
> >                         $("div.error").show();
> >                 } else {
> >                         $("div.error").hide();
> >                 }
> >         }).validate({ ... });
>
> > Jörn
>
> > On Thu, Jan 8, 2009 at 6:41 PM, morraine  wrote:
>
> > > hello i got a nice form system going with some custom placement of
> > > errors but i want to also count the amoutn of errors and display that
> > > as well. How can i do this in code?
>
> > > i have this :
>
> > > errorPlacement: function(error, element) {
>
> > >        error.appendTo( element.siblings('span.valmessage') )
>
> > >                }
>
> > > which displays the errors were i want them but when i try to use this
> > > as well to have a live view of the amount of errors:
>
> > > showErrors: function(errorMap, errorList) {
> > >                $("div#formerror span").html("Your form contains "
> > >                                   + this.numberOfInvalids()
> > >                                   + " errors, see details below.");
> > > }
>
> > > errorPlacement wont work with it?!?!?
>
> > > how can i merge the two functions together into showErrors option so
> > > as to place my errors where i want and also display the amount of
> > > errors at the same time
>
> > > thanks for help im new to jquery and im not sure how the show error
> > > option works in regards to the errorMap and errorList arguments that
> > > come into it.- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


[jQuery] Re: having a child div inherit a parent width

2009-01-08 Thread roxstyle

thank you, so much. I need to think less in css and more in jquery.
And also thank you for your great site, i just found it, and ordered
your book.

On Jan 8, 7:38 am, Karl Swedberg  wrote:
> This might be a little cleaner:
>
>    $(document).ready(function(){
>      var cellWidth = [80, 110, 145, 70, 100, 100, 236];
>      for (var i=0, cl= cellWidth.length; i        $('td:nth-child(' + (i+1) + ')').width(cellWidth[i])
>          .children().css({overflow: 'hidden'}).width(cellWidth[i]);
>      };
>    });
>
> (untested)
>
> --Karl
>
> 
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Jan 7, 2009, at 5:26 PM, roxstyle wrote:
>
>
>
> > $(document).ready(function(){
> >    $(".searchUser tbody td:first-child").css({"width":"80px"});
> >    $(".searchUser tbody td:nth-child(2)").css({"width":"110px"});
> >    $(".searchUser tbody td:nth-child(3)").css({"width":"145px"});
> >    $(".searchUser tbody td:nth-child(4)").css({"width":"70px"});
> >    $(".searchUser tbody td:nth-child(5)").css({"width":"100px"});
> >    $(".searchUser tbody td:nth-child(6)").css({"width":"100px"});
> >    $(".searchUser tbody td:nth-child(7)").css({"width":"236px"});
>
> >    $(".tbl tbody td").each(function(i){
> >    var $tdWidth = $(this).css("width");
> >    $(this).children().css({'overflow':'hidden','width':$tdWidth});
> >    });
>
> > });
>
> > ok, i have this working for my sample. Along with some added insight.
> > (1) the children need to inherit the "td" given width- not the width
> > that the browser sees. (2)The only way i could get this to inherit, is
> > to have the width declared inline (now generated from the js file and
> > not the css file), then the children can inherit the style "width".
> > I do not like all these inline styles showing up in the code,
> > but...its working.
>
> > On Jan 7, 12:06 pm, amuhlou  wrote:
> >> you're quite welcome :)
>
> >> On Jan 7, 3:02 pm, roxstyle  wrote:
>
> >>> thank you so much, that is going to work.
>
> >>> On Jan 7, 11:55 am, amuhlou  wrote:
>
>  I accidentally replied directly to the author, so for anyone  
>  curious
>  about the same thing, you could use the following code:
>
>  $(document).ready(function() {
>          $(".tbl tbody td").each(function(i) {
>                  var $tdWidth = $(this).width();
>                  $(this).children().width($tdWidth);
>          });
>
>  });
>
>  This code goes through the .tbl table, and for each td it finds its
>  width and then applies that width to its children.
>
>  On Jan 7, 2:04 pm, roxstyle  wrote:
>
> > no, not exactly.
> > if the div contains a long email or url with no spaces-the  div  
> > will
> > expand beyond the intended width set for the "td" and essentailly
> > break the table layout. What i am trying to achieve is to place  
> > the
> > actual "td" content in a "div" and have the "div" (1) inherit the
> > parent td width, with (2)overflow: hidden. I have already given  
> > the
> > overflow property in the stylesheet. I am thinking I need to  
> > have js
> > that will automatically give any nested "div" the width of its  
> > parent.
>
> > in my 
> > samplehttp://www.roxstyle.com/projects/blssi/cms/user-tools-v1/user-search
> > 
> > if you click on the "search" for the user tab (default tab)-  
> > there is
> > a result table with sample content like this.
> > in row one- the content for the third cell expands.
> > in row two- the content has an inline style for the width, and  
> > in this
> > case the content "cuts off" at this width.
>
> > i hope this makes sense, i am more css/html experienced than js
> > experiened. i would appreciate any help, if i am not explaining  
> > the
> > intended behavior
>
> > On Jan 7, 1:10 am, peet  wrote:
>
> >> isn't that not the same as setting "width:100%" to all childs?
>
> >> On Jan 7, 2:42 am, roxstyle  wrote:
>
> >>> I have a table where each td has its width declared in css  
> >>> rules.
> >>> Inside some "td" i have either "p" or "div"
> >>> I want to have these elements inherit the width of the parent  
> >>> td.
> >>> I have a sample here 
> >>> -http://www.roxstyle.com/projects/blssi/cms/user-tools-v1/user-search
> >>> 
> >>> if you click on the "user" search, you will get a results  
> >>> table and
> >>> several of the td have got purposely long (non-spaced text)
> >>> the tds have a width within css, but the div does not inherit  
> >>> that. If
> >>> i give the div the pixel width, with overflow:hidden - i get the
> >>> results i want -the table structure stays in place and the  
> >>> extra text
> >>> is hidden
> >>> i would like to make a function that would globally give the  
> >>> css width
> >>> of each td to its children
>
> >>> im trying things like:
> >>> $(d

[jQuery] Re: Tutorials or examples of jQuery and ColdFusion?

2009-01-08 Thread Josh Nathanson

JSON is never "necessary" per se, but it's such a nice and lightweight
method of passing data around that it is becoming the de facto standard for
ajax applications.

I haven't tried it, but I think if you use "returnFormat=json" in your
cffunction in CF8, this accomplishes the same thing that cfjson.cfc is doing
- convert any deep structures into a json string.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Thursday, January 08, 2009 10:45 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Tutorials or examples of jQuery and ColdFusion?


Thanks for the tip, Josh.

As a matter of fact, that's the tutorial that I modified
to create a modal window, ajax-based login I just finished.

It uses cfjson.cfc.  Part of what I was wondering is if cfjson.cfc
is still required or the recommended approach to CF and ajax in light
of CF 8's built-in ajax functionality.

I also have questions about when JSON is necessary, etc., too.

I'm just trying to get more of a general education about CF and ajax.

Rick

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Josh Nathanson
> Sent: Thursday, January 08, 2009 1:18 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: Tutorials or examples of jQuery and ColdFusion?
> 
> 
> Rick - if you go to the jQuery site, and look under Tutorials, there is an
> example there.  It's not super detailed but it should give you some
insight.
> 
> -- Josh
> 
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Rick Faircloth
> Sent: Thursday, January 08, 2009 9:45 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Tutorials or examples of jQuery and ColdFusion?
> 
> 




[jQuery] Re: Correct way using Jquery

2009-01-08 Thread Josh Nathanson

I've run up against this event binding limit.  If you have 1000 or so DOM
items to bind to event handlers, you will see the slowness, and/or get ye
olde "you have a long running script" browser alert.

One way around it is to use event delegation, but this has its plusses and
minuses as well.  In my case using inline events in this limited case worked
fine and I haven't had to revisit the issue since then.

-- Josh


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Eric Garside
Sent: Thursday, January 08, 2009 10:11 AM
To: jQuery (English)
Subject: [jQuery] Re: Correct way using Jquery


For the sake of maintainability and reuseability, inline events are a
poor decision if you're using a robust library such as jQuery. A lot
of the jQuery source code is aimed at traversing, manipulating, and
hooking the DOM events. Using jQuery and inline events is like buying
a ferrari and hooking it up to a horse to pull it.

Do you have an example of a large, complex page where jQuery is too
slow to list inline events? I've never even heard such an indictment
against event handling outside of the markup.

On Jan 8, 12:26 pm, Matt Kruse  wrote:
> On Jan 8, 9:17 am, Eric Garside  wrote:
>
> > And, never, ever use inline events.
>
> I disagree. I use them all the time, because it's too slow to attach
> them after page load using jQuery, especially on large, complex pages.
>
> Matt Kruse



[jQuery] Re: showErrors and errorPlacement [validation]

2009-01-08 Thread morraine

Hi jörn thanks for the reply;

OK yes i have seen than demo and ive played about with it as well but
it seems to only update the amount when you click the submit button. I
want it to update on every validation event (keyup, focus etc) so
that when you enter the correct information for 5 incorrect fields it
will update as you go with each field validation. and then if all the
fields have been entered correctly then it will hide all with out
hitting the submit button again. then  the user can hit the submit
button.

How can i do this?

Thanks again for you help.

On Jan 8, 6:43 pm, "Jörn Zaefferer" 
wrote:
> Take a look at this demo:http://jquery.bassistance.de/validate/demo/marketo/
> The interesting part is here:
>
>         $("form").bind("invalid-form.validate", function(e, validator) {
>                 var errors = validator.numberOfInvalids();
>                 if (errors) {
>                         var message = errors == 1
>                                 ? 'You missed 1 field. It has been 
> highlighted below'
>                                 : 'You missed ' + errors + ' fields.  They 
> have been highlighted below';
>                         $("div.error span").html(message);
>                         $("div.error").show();
>                 } else {
>                         $("div.error").hide();
>                 }
>         }).validate({ ... });
>
> Jörn
>
>
>
> On Thu, Jan 8, 2009 at 6:41 PM, morraine  wrote:
>
> > hello i got a nice form system going with some custom placement of
> > errors but i want to also count the amoutn of errors and display that
> > as well. How can i do this in code?
>
> > i have this :
>
> > errorPlacement: function(error, element) {
>
> >        error.appendTo( element.siblings('span.valmessage') )
>
> >                }
>
> > which displays the errors were i want them but when i try to use this
> > as well to have a live view of the amount of errors:
>
> > showErrors: function(errorMap, errorList) {
> >                $("div#formerror span").html("Your form contains "
> >                                   + this.numberOfInvalids()
> >                                   + " errors, see details below.");
> > }
>
> > errorPlacement wont work with it?!?!?
>
> > how can i merge the two functions together into showErrors option so
> > as to place my errors where i want and also display the amount of
> > errors at the same time
>
> > thanks for help im new to jquery and im not sure how the show error
> > option works in regards to the errorMap and errorList arguments that
> > come into it.- Hide quoted text -
>
> - Show quoted text -


[jQuery] Re: Tutorials or examples of jQuery and ColdFusion?

2009-01-08 Thread Rick Faircloth

Thanks for the tip, Josh.

As a matter of fact, that's the tutorial that I modified
to create a modal window, ajax-based login I just finished.

It uses cfjson.cfc.  Part of what I was wondering is if cfjson.cfc
is still required or the recommended approach to CF and ajax in light
of CF 8's built-in ajax functionality.

I also have questions about when JSON is necessary, etc., too.

I'm just trying to get more of a general education about CF and ajax.

Rick

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Josh Nathanson
> Sent: Thursday, January 08, 2009 1:18 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: Tutorials or examples of jQuery and ColdFusion?
> 
> 
> Rick - if you go to the jQuery site, and look under Tutorials, there is an
> example there.  It's not super detailed but it should give you some insight.
> 
> -- Josh
> 
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Rick Faircloth
> Sent: Thursday, January 08, 2009 9:45 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Tutorials or examples of jQuery and ColdFusion?
> 
> 




[jQuery] Re: newbie code assessment please?

2009-01-08 Thread Eric Garside

That's what we're here for. :P

On Jan 8, 1:15 pm, the_guv  wrote:
> Hey Eric and Ricardo ... thank you so very much, and to MorningZ too ...
> cracking support, most generous.
>
> I'll work on your ideas tonight and report back my progress.
>
> Olly.
>
> Eric Garside wrote:
> > Why not simplify it a bit more and avoid the whole class lookup?
>
> > 
> >      
> >      
> >      
> >      
> >     
> >      
> > 
>
> > jQuery(function($){
>
> >    $('.menu li').click(function(){
> >        $($(this).attr('href')).fadeIn(500).siblings().hide();
> >        $("#menu").hide();
> >        $("#menuTop li a").fadeIn("500");
> >    });
>
> > });
>
> > On Jan 8, 11:30 am, Ricardo Tomasi  wrote:
>
> >> I bet this will only confuse you, but this is the way I'd do the popup
> >> part:
>
> >>     
> >>         
> >>         
> >>         
> >>         
> >>         
> >>         
> >>       
>
> >> 
> >>     
> >>     
> >>     
> >>     
> >>     
> >>     
> >>      etc...
> >> 
>
> >> jQuery(function($){
>
> >>    $('.menu li').click(function(){
> >>        var n = $(this).attr('href').substring(1); // web, content, pc,
> >> etc..
> >>        $('#popBoxes').children('.'+n).fadeIn(500) // show the one you
> >> want
> >>           .siblings().hide() // hide the others
> >>        $("#menu").hide();
> >>        $("#menuTop li a").fadeIn("500");
> >>    });
>
> >> });
>
> >> This single function would work for all menu items, and it's
> >> unnecessary to save the popup state.
>
> >> On Jan 8, 1:08 pm, Eric Garside  wrote:
>
> >>> Okay, the first step here is to be smart about how you write your
> >>> html, and manage your hide/show. Use HTML to group your elements
> >>> together, so you only ever need to hide a single element, and use the
> >>> ref tag on your anchor () tags to store a code-readable value of
> >>> the popup you want to fire.
>
> >>> 
> >>>     
> >>>         ...
> >>>     
> >>>     
> >>>         ...
> >>>     
> >>>     
> >>>         ...
> >>>     
> >>> 
>
> >>> Click to launch pop box 1
> >>> Click to launch pop box 2
>
> >>> Doing it this way will save you a BUNCH of headaches later, as we'll
> >>> see coming up. Second, be smart about what your code is actually
> >>> doing. From first glance, it looks to me that you're never going to
> >>> have a situation where more than one popup box is open at a time. If
> >>> I'm correct in my assumption, then this should be super helpful for
> >>> you:
>
> >>> var frame = {};
>
> >>> function hidePopup(){
> >>>      frame.last.hide();
> >>>      frame.menu.customFadeIn('fast');
>
> >>> }
>
> >>> function showPopup(label){
> >>>     if ( frame.last)
> >>>         frame.last.hide();
> >>>     frame.last = frame.popup.eq(label);
> >>>     frame.last.customFadeIn('fast');
> >>>     frame.top.customFadeIn("fast");
>
> >>> }
>
> >>> jQuery(document).ready(function(){
> >>>     frame.menu = jQuery('#menu');
> >>>     frame.top = jQuery('#menuTop li a');
> >>>     frame.popup = jQuery('#popBoxes').children();
> >>>     jQuery('launchpop').click(function(){
> >>>         showPopup(jQuery(this).attr('ref'))
> >>>         return false;
> >>>     });
>
> >>> });
>
> >>> Now, I've introduced a new thing here, the "frame" object. In code
> >>> where I'm going to be reusing a bunch of references, I keep references
> >>> to them in a frame object, so I don't make jQuery go through the
> >>> document and find them again. It also really helps to trim up the
> >>> code, as you can see there. In the doc.ready function we do the
> >>> assignments that make the whole thing work.
>
> >>> That code should easily replace all the code you had before, and
> >>> should work even more effectively. A couple points to understand about
> >>> the code there:
>
> >>> 1. Storing references is always faster than doing the lookups again.
> >>> 2. If you hide/show a container element, you don't have to hide/show
> >>> all of it's children. It's actually a bunch of extra work/code with no
> >>> purpose. Even if you told jQuery to show '#popBoxContent1', if
> >>> '#popBox1' was still hidden, the content wouldn't show up anywhere.
> >>> 3. I assume you're also using another javascript framework that uses
> >>> the "$" function? If your not, you can easily replace all the 'jQuery
> >>> (...)' calls with '$(...)', which is nice, since  the smaller your JS
> >>> files, the faster they get to your users (size matters a lot in JS).
> >>> Also, if you aren't using another framework, you can replace this
> >>> entire line: 'jQuery(document).ready(function(){' with '$(function(){'
> >>> 4. Make use of attribute tags and classes to do your work for you.
> >>> Putting ref="1" on the  tag is one way to really help. If you know
> >>> you're going to be repeating patterns of code, try to find the
> >>> simplest way to do it. One thing you should practice to really help
> >>> yourself in programming javascript is being super lazy. The lazier you
> >>> are, the better your code will work. Frequently ask the quest

[jQuery] Re: showErrors and errorPlacement [validation]

2009-01-08 Thread Jörn Zaefferer
Take a look at this demo: http://jquery.bassistance.de/validate/demo/marketo/
The interesting part is here:

$("form").bind("invalid-form.validate", function(e, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field. It has been highlighted 
below'
: 'You missed ' + errors + ' fields.  They have 
been highlighted below';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
}).validate({ ... });

Jörn

On Thu, Jan 8, 2009 at 6:41 PM, morraine  wrote:
>
> hello i got a nice form system going with some custom placement of
> errors but i want to also count the amoutn of errors and display that
> as well. How can i do this in code?
>
> i have this :
>
> errorPlacement: function(error, element) {
>
>error.appendTo( element.siblings('span.valmessage') )
>
>}
>
> which displays the errors were i want them but when i try to use this
> as well to have a live view of the amount of errors:
>
> showErrors: function(errorMap, errorList) {
>$("div#formerror span").html("Your form contains "
>   + this.numberOfInvalids()
>   + " errors, see details below.");
> }
>
> errorPlacement wont work with it?!?!?
>
> how can i merge the two functions together into showErrors option so
> as to place my errors where i want and also display the amount of
> errors at the same time
>
> thanks for help im new to jquery and im not sure how the show error
> option works in regards to the errorMap and errorList arguments that
> come into it.


[jQuery] Re: Tutorials or examples of jQuery and ColdFusion?

2009-01-08 Thread Rick Faircloth

Hi, Andy...and thanks for the reply.

Nothing specific at this point, but just anything to help
me see how ajax does its thing.  It's a little confusing
how the data flows.  I mean, I can make it work...I'd just
like to understand it better.  And I'd like to see some
examples of "best" or at least "better" practices than I
may be using.

If you've got any jQ and CF examples involving ajax, I'd
love to take a look at the code and see how you're approaching it.

Thanks!

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Andy Matthews
> Sent: Thursday, January 08, 2009 1:13 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: Tutorials or examples of jQuery and ColdFusion?
> 
> 
> I've used CF and jQuery a lot. Did you have something specific in mind? I'd
> be happy to share some code with you.
> 
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Rick Faircloth
> Sent: Thursday, January 08, 2009 11:45 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Tutorials or examples of jQuery and ColdFusion?
> 
> 




[jQuery] Re: jQuery-dependent TouchGraph Visualization (experiment)

2009-01-08 Thread David Decraene

Well, suprisingly there was an issue with drawing.
The script made an overzealous use of the jquery function
$element.offset();
Storing the position as variable instead of accessing it by offset()
led to a very notable increase in performance.

See demo at http://jowl.ontologyonline.org/TouchGraph.html



On 8 jan, 08:37, David Decraene  wrote:
> The great thing of html of course is that you can use css, means you
> can style it easily (demo has very basic styling, some rounded corners
> in firefox).
> Not sure how flexible styling in raphael is, I'm not familiar enough
> with it.
> Also don't think canvas or svg will be any faster, because the issue
> is not with drawing the changes, but with calculating the position of
> each node (=Javascript Math).
>
> On Jan 8, 2:27 am, Ricardo Tomasi  wrote:
>
> > using "NO" Canvas or SVG is not that great a feature is it? :)
>
> > Make that use raphael.js and it's all set!
>
> > On Jan 7, 5:13 pm, David Decraene  wrote:
>
> > > Thanks!
>
> > > It does need some computations that scale exponentially with the
> > > amount of nodes shown...
> > > but I think it seems to perform ok with a not too high amount of
> > > nodes, for an implementation that only uses html elements. Who nows,
> > > with future browsers (or a better algorithm :)) things might scale
> > > better...
>
> > > Greetings
> > > David
>
> > > On 7 jan, 19:00, Joe  wrote:
>
> > > > Very impressive!  Seems a bit sluggish at times in FF 3.0.5, but nice
> > > > work!
>
> > > > Joe
>
> > > > On Jan 7, 5:12 am, David Decraene  wrote:
>
> > > > > I had some fun creating a pure HTML-DOM based Force-directed graph
> > > > > layout, similar to a touchgraph (http://www.touchgraph.com/) view.
>
> > > > > Built with the help of jQuery (hereby again: wonderful library), no
> > > > > canvas or SVG used (only DOM manipulations).
>
> > > > > You can see an experimental demo 
> > > > > at:http://jowl.ontologyonline.org/TouchGraph.html.
> > > > > and the blog 
> > > > > post:http://ontologyonline.blogspot.com/2009/01/experimental-touchgraph-vi
>
> > > > > Room for lot's of improvement, but nevertheless quite happy with the
> > > > > result already.
>
> > > > > David Decraenehttp://ontologyonline.org


[jQuery] Re: Finding a tag on a page

2009-01-08 Thread Mastro

Figured it out thanks.  $("#ID") didn't realize it was on the
documentation either

On Jan 8, 12:47 pm, Mastro  wrote:
> I'm new to Jquery, and wondering how in JS using JQ how I can find a
> specific control on a page based off it's ID.  Also can I use
> it's .net ID, or do I need to use the ClientID? I'm assuming
> ClientID..
>
> $..find("ControlID")


[jQuery] Finding a tag on a page

2009-01-08 Thread Mastro

I'm new to Jquery, and wondering how in JS using JQ how I can find a
specific control on a page based off it's ID.  Also can I use
it's .net ID, or do I need to use the ClientID? I'm assuming
ClientID..

$..find("ControlID")


[jQuery] Re: Tutorials or examples of jQuery and ColdFusion?

2009-01-08 Thread Josh Nathanson

Rick - if you go to the jQuery site, and look under Tutorials, there is an
example there.  It's not super detailed but it should give you some insight.

-- Josh

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Thursday, January 08, 2009 9:45 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Tutorials or examples of jQuery and ColdFusion?


Hi, all...

I think I saw it mentioned that someone had written
some examples of using jQuery on the front-end and
ColdFusion on the backend for ajax work.

Most of the stuff I find on the 'Net with jQuery
and PHP.

Perhaps the examples were written in conjunction
with a plug-in?

I'd appreciate any clues.

Thanks,

Rick



[jQuery] Trouble refreshing div with .load

2009-01-08 Thread Rick Faircloth

I'm using the following code to refresh a menu
based on a user's access privileges.  The login
is via a modal window.

$.ajax({
  type: "POST",
  url:  "login/login_processor.cfm",
  dataType: "json",
  data: formval,
  success: function(response){

if (response.login == "Login Successful")
   { $('#logstatus').empty().append("Log Out");
 $('#menu').hide();
 $('#menu').load("includes/include_menu_index.cfm").show();
tb_remove() }

It's performing property in FF3, but IE6 and IE7
aren't refreshing the #menu.  I have to refresh the
page manually to get the menu to display correct items.

Is there some way I can rewrite this part:

$('#menu').hide();
$('#menu').load("includes/include_menu_index.cfm").show();

or should that be sufficient.

Thanks,

Rick





[jQuery] Re: Tutorials or examples of jQuery and ColdFusion?

2009-01-08 Thread Andy Matthews

I've used CF and jQuery a lot. Did you have something specific in mind? I'd
be happy to share some code with you. 

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Thursday, January 08, 2009 11:45 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Tutorials or examples of jQuery and ColdFusion?


Hi, all...

I think I saw it mentioned that someone had written some examples of using
jQuery on the front-end and ColdFusion on the backend for ajax work.

Most of the stuff I find on the 'Net with jQuery and PHP.

Perhaps the examples were written in conjunction with a plug-in?

I'd appreciate any clues.

Thanks,

Rick




[jQuery] Re: newbie code assessment please?

2009-01-08 Thread the_guv




Hey Eric and Ricardo ... thank you so very much, and to MorningZ too
... cracking support, most generous.

I'll work on your ideas tonight and report back my progress.

Olly.


Eric Garside wrote:

  Why not simplify it a bit more and avoid the whole class lookup?


 
 
 
 

 



jQuery(function($){

   $('.menu li').click(function(){
   $($(this).attr('href')).fadeIn(500).siblings().hide();
   $("#menu").hide();
   $("#menuTop li a").fadeIn("500");
   });

});

On Jan 8, 11:30 am, Ricardo Tomasi  wrote:
  
  
I bet this will only confuse you, but this is the way I'd do the popup
part:

    
        
        
        
        
        
        
      


    
    
    
    
    
    
     etc...


jQuery(function($){

   $('.menu li').click(function(){
       var n = $(this).attr('href').substring(1); // web, content, pc,
etc..
       $('#popBoxes').children('.'+n).fadeIn(500) // show the one you
want
          .siblings().hide() // hide the others
       $("#menu").hide();
       $("#menuTop li a").fadeIn("500");
   });

});

This single function would work for all menu items, and it's
unnecessary to save the popup state.

On Jan 8, 1:08 pm, Eric Garside  wrote:



  Okay, the first step here is to be smart about how you write your
html, and manage your hide/show. Use HTML to group your elements
together, so you only ever need to hide a single element, and use the
ref tag on your anchor () tags to store a code-readable value of
the popup you want to fire.
  


  
    
        ...
    
    
        ...
    
    
        ...
    

  


  Click to launch pop box 1
Click to launch pop box 2
  


  Doing it this way will save you a BUNCH of headaches later, as we'll
see coming up. Second, be smart about what your code is actually
doing. From first glance, it looks to me that you're never going to
have a situation where more than one popup box is open at a time. If
I'm correct in my assumption, then this should be super helpful for
you:
  


  var frame = {};
  


  function hidePopup(){
     frame.last.hide();
     frame.menu.customFadeIn('fast');
  


  }
  


  function showPopup(label){
    if ( frame.last)
        frame.last.hide();
    frame.last = frame.popup.eq(label);
    frame.last.customFadeIn('fast');
    frame.top.customFadeIn("fast");
  


  }
  


  jQuery(document).ready(function(){
    frame.menu = jQuery('#menu');
    frame.top = jQuery('#menuTop li a');
    frame.popup = jQuery('#popBoxes').children();
    jQuery('launchpop').click(function(){
        showPopup(jQuery(this).attr('ref'))
        return false;
    });
  


  });
  


  Now, I've introduced a new thing here, the "frame" object. In code
where I'm going to be reusing a bunch of references, I keep references
to them in a frame object, so I don't make jQuery go through the
document and find them again. It also really helps to trim up the
code, as you can see there. In the doc.ready function we do the
assignments that make the whole thing work.
  


  That code should easily replace all the code you had before, and
should work even more effectively. A couple points to understand about
the code there:
  


  1. Storing references is always faster than doing the lookups again.
2. If you hide/show a container element, you don't have to hide/show
all of it's children. It's actually a bunch of extra work/code with no
purpose. Even if you told jQuery to show '#popBoxContent1', if
'#popBox1' was still hidden, the content wouldn't show up anywhere.
3. I assume you're also using another _javascript_ framework that uses
the "$" function? If your not, you can easily replace all the 'jQuery
(...)' calls with '$(...)', which is nice, since  the smaller your JS
files, the faster they get to your users (size matters a lot in JS).
Also, if you aren't using another framework, you can replace this
entire line: 'jQuery(document).ready(function(){' with '$(function(){'
4. Make use of attribute tags and classes to do your work for you.
Putting ref="1" on the  tag is one way to really help. If you know
you're going to be repeating patterns of code, try to find the
simplest way to do it. One thing you should practice to really help
yourself in programming _javascript_ is being super lazy. The lazier you
are, the better your code will work. Frequently ask the question "What
can I do to make this really easy for me to do?".
  


  That's all I got for now. If you've got questions on any of the code
or ideas I dropped in here, let me know. :)
  


  On Jan 8, 7:29 am, the_guv  wrote:
  


  
well, a big tx to MorningZ...I have - _or rather MorningZ has_ - managed
to strip a bunch of extraneous code, but I don't see how I can shorten
the final fun

[jQuery] Re: Problem setting html in iframe.

2009-01-08 Thread m.ugues

It works, Thanks a lot :)
Kind regards

Massimo

On Jan 8, 5:48 pm, "Jörn Zaefferer" 
wrote:
> Try this:
> $("iframe")[0].contentDocument.body.innerHTML = "HELLO"
>
> Jörn
>
> On Thu, Jan 8, 2009 at 5:41 PM, m.ugues  wrote:
>
> > Hallo all.
> > I would like to set the html content of on iframe via jquery,
>
> > I have a page where is defined the iframe:
> >      ...
> >      
> >                
> >                
> >        
>
> > and via jquery I set the html like this:
>
> > jQuery('#operativita').html('foo');
> > jQuery('#myDiv').html('foo');
>
> > It works with the div but not with the iframe.
> > I tried several ways (e.g jQuery
> > ('#operativita').contentDocument.innerHTML = "foo"); but none of them
> > work.
>
> > Any idea?
>
> > Kind regards
>
> > Massimo


[jQuery] Re: Correct way using Jquery

2009-01-08 Thread Eric Garside

For the sake of maintainability and reuseability, inline events are a
poor decision if you're using a robust library such as jQuery. A lot
of the jQuery source code is aimed at traversing, manipulating, and
hooking the DOM events. Using jQuery and inline events is like buying
a ferrari and hooking it up to a horse to pull it.

Do you have an example of a large, complex page where jQuery is too
slow to list inline events? I've never even heard such an indictment
against event handling outside of the markup.

On Jan 8, 12:26 pm, Matt Kruse  wrote:
> On Jan 8, 9:17 am, Eric Garside  wrote:
>
> > And, never, ever use inline events.
>
> I disagree. I use them all the time, because it's too slow to attach
> them after page load using jQuery, especially on large, complex pages.
>
> Matt Kruse


[jQuery] Tutorials or examples of jQuery and ColdFusion?

2009-01-08 Thread Rick Faircloth

Hi, all...

I think I saw it mentioned that someone had written
some examples of using jQuery on the front-end and
ColdFusion on the backend for ajax work.

Most of the stuff I find on the 'Net with jQuery
and PHP.

Perhaps the examples were written in conjunction
with a plug-in?

I'd appreciate any clues.

Thanks,

Rick



[jQuery] showErrors and errorPlacement [validation]

2009-01-08 Thread morraine

hello i got a nice form system going with some custom placement of
errors but i want to also count the amoutn of errors and display that
as well. How can i do this in code?

i have this :

errorPlacement: function(error, element) {

error.appendTo( element.siblings('span.valmessage') )

}

which displays the errors were i want them but when i try to use this
as well to have a live view of the amount of errors:

showErrors: function(errorMap, errorList) {
$("div#formerror span").html("Your form contains "
   + this.numberOfInvalids()
   + " errors, see details below.");
}

errorPlacement wont work with it?!?!?

how can i merge the two functions together into showErrors option so
as to place my errors where i want and also display the amount of
errors at the same time

thanks for help im new to jquery and im not sure how the show error
option works in regards to the errorMap and errorList arguments that
come into it.


[jQuery] Re: Ajax: how to choose between post, get or ajax() ??

2009-01-08 Thread Alexandre Plennevaux

Thank you Mike. I 'm set to use ajax() because  i think i need the
cache option set to false.

On Thu, Jan 8, 2009 at 6:23 PM, Mike Alsup  wrote:
>
>> I need to silently update an xml file to store some user's usage
>> statistics, basically i pass an object to a php script, which
>> generates the xml and stores it in a file.
>>
>> Now, looking at the ajax chapter of the docs, i'm not quite sure
>> what's the best method to do that:
>> $.get, $.post or $.ajax ?
>>
>> I think $.post() is good enough for my need but i'd be very interested
>> to hear your opinion.
>
> $.get and $.post are just convenience methods that cover $.ajax.  In
> your case a 'get' is inappropriate (from a semantic point of view;
> you're changing data) so $.post or $.ajax should be used.  If you need
> fine-grained control over the options then use $.ajax.  Otherwise
> $.post will call $.ajax for you passing in default option values.
>
> Mike
>


[jQuery] Re: Correct way using Jquery

2009-01-08 Thread Matt Kruse

On Jan 8, 9:17 am, Eric Garside  wrote:
> And, never, ever use inline events.

I disagree. I use them all the time, because it's too slow to attach
them after page load using jQuery, especially on large, complex pages.

Matt Kruse



[jQuery] Re: Ajax: how to choose between post, get or ajax() ??

2009-01-08 Thread Mike Alsup

> I need to silently update an xml file to store some user's usage
> statistics, basically i pass an object to a php script, which
> generates the xml and stores it in a file.
>
> Now, looking at the ajax chapter of the docs, i'm not quite sure
> what's the best method to do that:
> $.get, $.post or $.ajax ?
>
> I think $.post() is good enough for my need but i'd be very interested
> to hear your opinion.

$.get and $.post are just convenience methods that cover $.ajax.  In
your case a 'get' is inappropriate (from a semantic point of view;
you're changing data) so $.post or $.ajax should be used.  If you need
fine-grained control over the options then use $.ajax.  Otherwise
$.post will call $.ajax for you passing in default option values.

Mike


[jQuery] How to access a jQuery object instance?

2009-01-08 Thread WoutervD

Hello there,

I would like to know how i can access properties of a jQuery object
instance.
I have the following javascript: 
http://paste.pocoo.org/show/U9Gsy68MKP9LvvAvqGI6/

I would like to access the instance from my HTML file and pass value's


jObject.sValue = "a value :)";


How can I do this?

The way jQuery is written confuses me a little (just started using it)


[jQuery] Re: bind the same functionality to load and change event

2009-01-08 Thread jQuery Lover
Move your code to some function and then call it on document ready and
onchange-event:

function myMethod(){
  // my custom js code
}

$(document).ready(function(){
  myMethod();
  $("#properties div select").bind("change",myMethod());
});

-- 
jQuery HowTo Resource 



On Thu, Jan 8, 2009 at 2:19 PM, lsblsb  wrote:

>
> hi there,
>
> i want to execute the same lines of code when the site has finished
> loading AND when an onchange-event is fired.
>
> i tried something like
>
> $("#properties div select").bind("ready change",function(e){
> $("#properties div select").bind("load change",function(e){
>
> but this does not work :/
>
> can you tell me how to do something like that?
>
> thank you!
>


  1   2   >