[jQuery] Re: Regular Expression validation

2009-08-09 Thread KeeganWatkins

With all due respect, I think karl's solution is somewhat less than
elegant, and could be improved by refactoring to:

// test for anything but numbers
var isValid = /[^\d]/g.test(textareaValString);

if (isValid) {
// proceed with confidence
} else {
// note to user: no numbers allowed!
}

On Aug 8, 11:13 pm, Karl Swedberg k...@englishrules.com wrote:
 On Aug 7, 2009, at 2:53 PM, Michael Lawson wrote:

  yes, you can grab the value of the textbox and match it against a  
  regular expression
  var reg = new RegExp(/[a-zA-Z]/);
  if(reg.test(string))
  {
  return valid;
  }
  else
  {
  return not valid;
  }

 Hey Michael,

 I don't think that regular expression is going to work. If you're  
 using a regular expression constructor method, as opposed to a  
 literal, you shouldn't use the slashes. Even without the slashes, that  
 test will always return true as long as the string has one upper or  
 lower case letter from a to z.

 The OP wanted to disallow numbers, so this should do it:

 if ( !(/\d/).test(string) ) {
    return 'valid';} else {

    return 'not valid';

 }

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com


[jQuery] (validate) min. value based on another form element?

2009-08-09 Thread Field

How do I setup this validation. Sel1 is always required.
If sel1 == 0, then sel2 must be  0.
If sel1  0, then sel2 can be anything.

select id=sel1 name=sel1 class=required
option value=/option
option value=00/option
option value=11/option
option value=22option
/select

select id=sel2 name=sel2
option value=0 selected0/option
option value=11option
option value=22option
/select


[jQuery] Re: Cross-browser problem

2009-08-09 Thread Denis Abramov

Any solution?


[jQuery] Re: Selecting element where the href contains string

2009-08-09 Thread Stephan Beal

On Aug 7, 9:36 pm, gray8110 gray8...@gmail.com wrote:
 $('li has(a[href$=.xls])').addClass('excel');

Try: $(li:has(...))

Note the : before has
http://docs.jquery.com/Selectors/has#selector

:)


[jQuery] Re: Navigation and sub navigation plugin

2009-08-09 Thread Stephan Beal

On Aug 9, 5:59 am, bharani kumar bharanikumariyer...@gmail.com
wrote:
 Assume if i have around 20 naviation means the i have to write
 jquery navigation and sub navigation snippet all pages ?

Every menu has to be populated, and if you've got 20 menus then you've
got to populate 20 menus. However, if you have so many of them you
should generate them from a DB or XML or some other idealized
representation, to make changing them easier. Try to avoid putting
each menu it its own html/php file, because that makes it really
difficult to change the any details which exist in all copies.

 Is there any short way there ,

 OR is there any similary navigation plugin available ,

There are tons of menu plugins. See:

http://plugins.jquery.com/project/Plugins/category/44


[jQuery] Re: News scroller

2009-08-09 Thread Sander Thalen

Marquee is of course way different and less flexible, plus it looks ugly. :)

On Wed, Aug 5, 2009 at 9:16 AM, ramachandran
natesanramachandranate...@gmail.com wrote:

 You can do this using MARQUEE a simple HTML tag

 On Jul 28, 12:59 pm, Andrea - Aosta andreabe...@gmail.com wrote:
 I have found thsi example made width 
 mootoolshttp://javascript.html.it/demo/javascript/5338/esempio.htm
 A similar plugin for jquery exists? Thank you



[jQuery] Re: Attribute selection not working in MSIE; eg $(input[name=name]).val()

2009-08-09 Thread HerrJuergen



On Aug 8, 11:34 am, V vincenti...@gmail.com wrote:
 Wow, that is strange it indeed works :o

 The error is;
 Object doesn't support this property or method

 But i figured what the problem is because I changed the code;
 div id=contactform
    div
     input type=text name=name value= /
    /div
 /div

 name = $(#contactform input[name=name]).val();

 But, it goes wrong on #contactform, I thought this should work?

 This does work but i do not prefer this
 name = $(#contactform div input[name=name]).val();

the correct syntax i think should be

var name = $(#contactform  div  input[name='name']).val();


[jQuery] Re: Cross-browser problem

2009-08-09 Thread Charlie





suggest putting a test page together on your server or you can use
jsbin.com which has jQuery library available

Denis Abramov wrote:

  Any solution?

  






[jQuery] New to jquery, multiple .js files not running

2009-08-09 Thread andrew.croce

I am very new to JQuery and to scripting in general so bear with me,
this might be a very easy fix and I dont know it.  I believe what Im
trying to do is about as simple as jquery gets...

Im building a simple portfolio site for myself and I am trying to use
the .hide() and .show() methods to hide and show the various sections
and subsections.  I have one file panels.js which is working fine on
its own to hide and show the main sections.  But a second file
gallery.js, which is supposed to control the subsections, never gets
read. I can see the contents of the file in firebug, but nothing
inside gets executed.  If I take the contents of gallery.js and try to
place them into the panels.js file. the whole thing stops working.  So
Im assuming its something off with the scripts in gallery.js.

Heres the site so far:
http://www.andrewcroce.com
At this point I am only working on the ARTWORK section, so that is
the only section that should be working, please don't bother clicking
on the other sections. What should be happening is that all the
entries that say Image Title with some lorem ipsum should all be
hidden at first, and only the first sentence at the top should show,
but at this point all of it just stacks up and none of it is hidden.

heres the contents of gallery.js

//hide all the subsections and show the intro
$(.current_panel .image_area).removeClass(current_area);
$(.current_panel .image_area).hide();
$(.current_panel .intro).show();
$(.current_panel .intro).addClass(current_area);
$(.back_tab).hide();

//when a tab is clicked that section is displayed
$(.tab).click(function(){
var current_section = $(this).attr(name);
$(.tab).removeClass(current_tab);
$(.current_panel .intro).hide();
$(.image_area).hide();
$(#+current_section+_tab).addClass(current_tab);
$(#+current_section+_area).addClass(current_area);
$(#+current_section+_area).show();
$(.back_tab).show();
$(.back_tab).click(function(){
$(.image_area).removeClass(current_area);
$(.image_area).hide();
$(.current_panel .intro).show();
$(this).hide();
return false;
});
return false;
});

Any pointers would be greatly appreciated.
Andrew


[jQuery] Multiple Image Fade

2009-08-09 Thread dc

Hi,

I'm trying to write a script to fade in/out some image thumbnails. I'm
trying to achieve the following:

1) Fade in/out individual thumbnails on thumbnail hover
2) Fade in/out all thumbnails of the a class when hovering over a text
link of the same class.

Everything works except that in #2 the images don't return to 0.5
opacity when the mouse leaves the text link.

I'm pretty new to jQuery, can anyone help me out? Here's my code:

script type=text/javascript
$(document).ready(function(){
$(img.thumb).fadeTo(1, 0.5); // fade when page loads

$(img.thumb).hover(
function() {
$(this).fadeTo(300, 1.0); // 100% on hover
},
function() {
$(this).fadeTo(300, 0.5); // 50% out
}
);

$(#work_list #name a).hover(
function() {
var post_id = $(this).attr(class);
$(img. + post_id).fadeTo(500, 1.0);
},
function() {
$(img. + post_id).fadeTo(500, 0.5);
}
);
});
/script

Thanks so much!


[jQuery] getJSON response limit

2009-08-09 Thread thephatp

I'm employing the getJSON call in a site I'm working on, but I'm
having a problem with the response not coming through if it is too
large.

I've read a number of posts talking about the request string being too
large (forcing a user to use POST), but what about the response string
being too large?  Would switching to POST fix this?

The data coming back could be broken down into smaller portions and
requested separately, but this seems like way overkill for what I'm
needing to do, not to mention that it's a nightmare trying to get it
all to return in the correct order (since some later requests complete
before the most recent one).

My current test is requesting about 50 objects (each with about 20
fields), but it fails after about 10 (scarcely populated) objects.  As
an alternative, I grabbed all 50 id's to the objects (in MySQL
database), and then proceeded to request each one individually.
However, since the request is asynchronous, I'm getting what should be
ordered results back, which isn't good.

So, I see two alternatives:

(1) Find a way to request all the data up front in a single call (very
preferable).

(2) Request each one individually as described above, and store the
values in a new javascript class, then re-order afterward.  This seems
like overkill, and I hope I don't have to go here.


Does anyone have any suggestions for #1 above or even another
alternative solution?  I'm all ears (or eyes in this case).

Thanks in advance for any help you can provide!

Chad


[jQuery] parsers is undefined in tablesorter?

2009-08-09 Thread Nelson Muntz

Hi,

I am trying to generate dynamically a table from a csv by using jquery
csv plugin and the jquery tablesorter plugin and tablesorter is giving
me a bizarre error each time I try to click on a header of the table
to sort it. Firebug shows:

parsers is undefined
return parsers[i].type;\n

seems to be in line 483 of the tablesorter.js

I found this post on this issue:
http://groups.google.com/group/jquery-en/browse_thread/thread/a22dcbf8c5d69202
but neither of those suggestions worked.

initially i thought this error was related to the table not being
fully rendered when the page loads, so right now i manually call
tablesorter() after i generate the table from the csv file. however i
still get this error message every time i try to sort it (by clicking
on the table headers).

Also, i suppose because of this error, the table renders at the bottom
of it some grey areas.

does anyone know what might be causing this error?

here is my code:

html

head
   script type=text/javascript src=http://jqueryjs.googlecode.com/
files/jquery-1.3.2.min.js/script
   script type=text/javascript src=http://tablesorter.com/
jquery.tablesorter.js/script
   script type=text/javascript src=http://plugins.jquery.com/files/
jquery.csv.js_0.txt/script
   script type=text/javascript id=js
   function sortThis() {
 $(#myTable).tablesorter({
// sortList:[[0,0],[2,1]]
 });
   };
/script
titletest table/title
/head

body

table id=myTable class=tablesorter cellspacing=1
cellpadding=0 border=0

thead
tr
thISBN/th
thFull Title/th
thChange History/th
thYear Range/th

/tr
/thead

tbody

script type=text/javascript

$.get('bfcompusci.csv', function(data) {
file = jQuery.csv()(data)
for (var x = 0; x  file.length; x++) {
str = tr;
for (var y = 0; y  file[x].length; y++) {
str += td + file[x][y] + /td;
}
str += /tr;
$('#myTable').append(str);
}
});

sortThis();
/script

/tbody
/table
/body
/html

thanks in advance for your help.


[jQuery] slideshow efect

2009-08-09 Thread Sudhakar

hi

i need a slieshow effec that i want to create for my personal website.
following is what i need

i want to display an image and below that will be text and this text
should be clickable and open in a new window and this way i want to
show few images and text with a certain duration for each.

there should be no left arrow and right arrow, instead each picture
along with the text should move from the right to left or from left to
right and stay for few seconds and the next one should appear and the
text should be clickable and open in a new window.

can anyone refer me to a website from where i can get this effect.

please advice.

thanks.


[jQuery] Question regarding jQuery.ready method

2009-08-09 Thread ujamu

I have developed an FF extension that loads a few JavaScript files
(one of which is jQuery) and attaches them to any given page being
viewed by the user.
The loading of the js files can ether happen during or after the web
page had been loaded into the browser.
Obviously, once the js files get loaded, I want to start doing some
stuff and I wanted to use the jQuery.ready method to determine when
the js code can start performing whatever needs to be done. However,
it does not seem to get fired if the extension only starts loading the
js files after the web page has already been fully loaded. Generally,
there does not seem to be a method in FF that tells me if the web page
is loaded or not but rather, only an event that can get fired upon
page load.
Am I missing something? if not, is there a workaround?


[jQuery] Question regarding jQuery.ready method

2009-08-09 Thread ujamu

I have developed an FF extension that loads a few JavaScript files
(one of which is jQuery) and attaches them to any given page being
viewed by the user.
The loading of the js files can ether happen during or after the web
page had been loaded into the browser.
Obviously, once the js files get loaded, I want to start doing some
stuff and I wanted to use the jQuery.ready method to determine when
the js code can start performing whatever needs to be done. However,
it does not seem to get fired if the extension only starts loading the
js files after the web page has already been fully loaded. Generally,
there does not seem to be a method in FF that tells me if the web page
is loaded or not but rather, only an event that can get fired upon
page load.
Am I missing something? if not, is there a workaround?


[jQuery] Where is the best place to insert JQuery code head or body

2009-08-09 Thread humour

Where is the best place to insert JQuery code head or body?

I have tried and my code works in either place vut where am I supposed
to put it?

Is there an advantage of putting it one place (head or body) over the
other?

Thanks in advance.

Humour


[jQuery] Re: trouble defining post variable when form element is dynamic

2009-08-09 Thread bhu Boue vidya

maybe you could use the rel attribute to set the id of each email
entry in your form (this would be done in php), and then use the value
of rel when sending info back to your ajax script

not sure exactly how your html is constructed, but this is roughly
what i am thinking:

li
johnciti...@blah.com input class=makeprimary type=button
rel=123 value=make primary/input
/li

$('.makeprimary').click(function() {
$.post(js/edit/edit_email.php, {
task: setprimary,
email_ID: $(this).attr('rel')
}, function(html) {
$(#emails).html(html);
});
});


and as far as i am aware, using rel in this way is valid xhtml

hth
bhu vidya

On Aug 8, 9:39 am, cookie king_coo...@hotmail.com wrote:
 Hi there, I am having this problem but no real ideas on how to solve
 it. I have a edit profile form that is loaded using .load. Within it I
 have a form for editing email addresses with a list of email addresses
 above it, this is also loaded/reloaded as a callback when a state
 change in the emails occurs. The user can add emails, make an email a
 primary and delete emails. My issue is with deleting:

                 $(.removeemail).change( function() {
                         $.post(js/edit/edit_email.php, { task: 
 setprimary, email_ID: $
 (EMAIL ID correspending to the delete button).val() },function(html)
 {
                                 $(#emails).html(html);
                         });
                 });

 My issue is with deleting. How do I set the email_ID value without a
 form element only php generated html. Before I would of used
 onchange=somejavascriptfunction(?php echo $email_id; ?) on the
 delete button but I cannot think of a way of doing this in jquery
 without using a select radio button type thing like I have done for
 setting primary email. Any ideas?


[jQuery] Autocomplete JSON filtering searches

2009-08-09 Thread sAmUrAi

I have a JSON dataset structured as follows
{
  {
city=value
area=value
  }
  {
city=value
area=value
  }
  {
city=value
area=value
  }
  ...
  ...
  ...
}

I need two autocomplete inputs,
 - one allowing only selections of cities and
 - one allowing selection of areas of the selected city

I have about 7 cities and 47 areas.


[jQuery] [ANNOUNCEMENT] jQuery LargePhotobox plugin

2009-08-09 Thread Alexsandro_xpt

Hi everyone,

Yesterday I released the first public release of my
jquery.largephotobox plugin.

I've posted it on the google code page:
http://code.google.com/p/jquery-largephotobox/

Demo page:
http://www.interag.net/largephotobox


[jQuery] Re: Jquery Remote Message is not showing up

2009-08-09 Thread Field

I think you need more than just Test in the remote: call. Look at
the jquery validation documentation and the examples he's provided.

For instance, this is my remote:
remote: {
url: 
/rtui/codeigniter/index.php/business_form/dupeCheck,
type: post,
data: {
action: function() {
return 
$(#action).val();
},
bus_id: function() {
return 
$(#bus_id).val();
}
}
}

On Aug 8, 5:41 pm, chobo2 mhub...@gmail.com wrote:
 Hi

 I am not sure what I am doing wrong I am using the Jquery.Validate
 plugin and it has a remote field

 so I did this

 [code]    $(#mainForm).validate(
         {
             rules:
             {
                 UserName:
                 {
                     required: true
                    ,remote: Test
                 }
              ,messages:
             {
                 UserName:
                 {
                     remote: UserName has already been choosen. Please
 choose another one
                 }
             }

          }
 [/code]
 the required works fine. It's the remote. I am using asp.net mvc and
 the path is right it hits my method

        [code] public bool Test(string userName)
         {
             return false;
         }
 [/code]

 it returns false according to firebug yet jquery.validate does not
 kick in. I am using Version 1.5.5 of jquery.validate and jquery 1.3.2

 What did I miss?

 P.S what is the default message for remote?


[jQuery] Best cookie plug-in?

2009-08-09 Thread ldexterldesign

Easy guys,

Just getting started with cookies this afternoon and wondering what
plug-in everyone is using these days?

Thanks,
L


[jQuery] Re: New to jquery, multiple .js files not running

2009-08-09 Thread Stephan Beal

On Aug 8, 7:25 pm, andrew.croce andrew.cr...@gmail.com wrote:
                 var current_section = $(this).attr(name);
...
                 $(#+current_section+_tab).addClass(current_tab);

This is wrong. The '#' searches by ID, not by name. Try (untested):

 var current_section = $(this).attr(id);



[jQuery] more VALIDATION issues

2009-08-09 Thread Miket3

OK.  the validation plugin is kicking my ass. as does every new thing
I try to learn.

FIRST: I need to clarify that there is a BUG up front so someone
doesn't offer it as a solution.
I am using version 1.5.5. It has a bug in the REMOTE rule/method so
this is not an option to check for duplicate entries. And I know this
because I set my lookup.php server script to a single line of ECHO
FALSE but the validator plugin still adds a valid to the element
class. Plus this was an issue in previous releases so it is more than
likely re-introduced. BUT if you think I am still wrong I am open to
suggestions so long a s they are detailed.

So with that issue behind me I went out and learned how to create a
custom method using the $.validator.addMethod() to solve my problem.
And now I have run into 2 more issues which are stopping me. If
someone can solve any 1 of these next 2 issues, I can be on my way.

1. I don't know how to grab a value returned from $.get() and put it
into a javascript variable that can be used outside the scope of the
$.get() event because I need to return that value .  I have tried
setting global variables all over the place but nothing gets set.

2. I also tried to just add an attribute to the element with the
return value, then use jquery to fetch that value. But there seems to
be a cache issue along the way. The attrib is being set correctly
(according to firebug) but the value is always 1 cycle behind. Oh...
and I do have CACHE:FALSE set.

so if anyone can help here is my code:

$.validator.addMethod(dupcheck,function(value,element){

var lookupkey = $(element).attr(name);
var lookupvalue = $(element).val();
var thisid = $(element).attr(id);
var valid_img = 'img src=/global_libs/images/icons/
checked.gif';
var error_img = 'img src=/global_libs/images/icons/
unchecked.gif';

$.get('lookup.php', {table : members, key : lookupkey, value :
lookupvalue, successmsg:false, failmsg:true }, function(data){  [I
NEED THE VALUE OF (DATA) TO BE RETURNED FROM HERE]  });
});

ok I will through in the server script as well:

here is my LOOKUP.PHP
?

$noheaders = true;  //prevents config.php from loading any header
data such a scripts and styles.
include(config.php);
$table = $_GET[table];
$key = $_GET[key];
$value = $_GET[value];
$failmsg = (isset($_GET[failmsg]) ? $_GET[failmsg] : $value.: Not
Found in TABLE: .$table. for KEY: .$key);
$successmsg = (isset($_GET[successmsg]) ? $_GET[successmsg] :
$value.: Found in TABLE: .$table. for KEY: .$key);
$sql=SELECT * FROM $table WHERE $key='$value' ;
$result=mysql_query($sql);
if (mysql_num_rows($result)  0) {
  echo $successmsg;
} else {echo $failmsg;  };

?

Thanks,
MIke


[jQuery] Re: getJSON response limit

2009-08-09 Thread Michael Geary

There is no set limit on the size of a JSON response, any more than there is
on an HTML or XML response. You can have very large JSON responses with no
problem.

GET vs. POST would have nothing to do with this. Those are only different in
the way the request is sent to the server; the response format for GET and
POST is identical.

When you say it fails, what fails? Is the server failing to generate a
complete JSON response? Is it being generated OK but running into trouble in
the browser? What exactly is failing and how?

-Mike

 From: thephatp
 
 I'm employing the getJSON call in a site I'm working on, but 
 I'm having a problem with the response not coming through if 
 it is too large.
 
 I've read a number of posts talking about the request string 
 being too large (forcing a user to use POST), but what about 
 the response string being too large?  Would switching to POST 
 fix this?
 
 The data coming back could be broken down into smaller 
 portions and requested separately, but this seems like way 
 overkill for what I'm needing to do, not to mention that it's 
 a nightmare trying to get it all to return in the correct 
 order (since some later requests complete before the most recent one).
 
 My current test is requesting about 50 objects (each with 
 about 20 fields), but it fails after about 10 (scarcely 
 populated) objects.  As an alternative, I grabbed all 50 id's 
 to the objects (in MySQL database), and then proceeded to 
 request each one individually.
 However, since the request is asynchronous, I'm getting what 
 should be ordered results back, which isn't good.
 
 So, I see two alternatives:
 
 (1) Find a way to request all the data up front in a single 
 call (very preferable).
 
 (2) Request each one individually as described above, and 
 store the values in a new javascript class, then re-order 
 afterward.  This seems like overkill, and I hope I don't have 
 to go here.
 
 
 Does anyone have any suggestions for #1 above or even another 
 alternative solution?  I'm all ears (or eyes in this case).
 
 Thanks in advance for any help you can provide!
 
 Chad



[jQuery] Re: New to jquery, multiple .js files not running

2009-08-09 Thread andrew.croce

What I was trying to do with  var current_section = $(this).attr
(name); was to create a variable that simply contained the name of
the particular subsection, which I could then attach to _tab to
pinpoint the currently selected tab.  I cant use the ID because it has
a different value, used for something else.  I used the name attribute
because it was convenient for creating that variable. Is this a bad
idea, could that be screwing up the whole file? or is the name
attribute inaccessible to jquery?

The bigger problem, it seems, is that nothing is running in that
gallery.js file, not even the first few lines...
$(.current_panel .image_area).removeClass(current_area);
$(.current_panel .image_area).hide();
$(.current_panel .intro).show();
$(.current_panel .intro).addClass(current_area);
$(.back_tab).hide();

These seem pretty straightforward to me and I don't understand why
theyre not working.  Im wondering if it cannot see the .current_panel
class, and hence cannot .hide() or .show() its children.  The
class .current_panel is added when a main menu btn is clicked, and the
script for that is in the other panels.js file, which, as I said, is
running perfectly. If all the javascript on the site is run on page
load, then there is no .current_tab class at the time, and hence
nothing will happen.  Is this a likely cause? and if so is there a way
to only run gallery.js once a menu btn is clicked? I tried adding the
contents of gallery.js to that click function in the other file, but
as I said, it broke the whole file.
Thanks,
Andrew

On Aug 9, 12:34 pm, Stephan Beal sgb...@googlemail.com wrote:
 On Aug 8, 7:25 pm, andrew.croce andrew.cr...@gmail.com wrote:

                  var current_section = $(this).attr(name);
 ...
                  $(#+current_section+_tab).addClass(current_tab);

 This is wrong. The '#' searches by ID, not by name. Try (untested):

                  var current_section = $(this).attr(id);


[jQuery] Re: Detect Capital Letters

2009-08-09 Thread Michael Geary
That would work for you and for me, but would it work for everyone?
 
alert( isUpperCase('JÖRN') ? 'good' : 'bad' );  // ;-)
 
-Mike


  _  

From: Karl Swedberg

Shouldn't be too much work. Wouldn't this do it? 


function isUpperCase( string ) {
return /^[A-Z]+$/.test(string);
}



On Aug 8, 2009, at 8:34 PM, Michael Geary wrote:



If you want to check that the string contains *only* uppercase characters
and no case-less characters (so that ABC would return true but A B C
would return false), that would be a bit more work. 



[jQuery] Re: Best cookie plug-in?

2009-08-09 Thread Jack Killpatrick


I've used this with success:

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

- Jack

ldexterldesign wrote:

Easy guys,

Just getting started with cookies this afternoon and wondering what
plug-in everyone is using these days?

Thanks,
L

  





[jQuery] Table Manipulation

2009-08-09 Thread achu

Hello Friends,

I'm trying to create a dynamic table using jQuery
- Manipulation/appendTo. Here is my code below:

$(#btnAdd).live(click, function()
{
$(trtdinput type='text'//tdtdinput type='text'//
tdtdinput type='text'//td/tr).appendTo(#tblGrid);
});

The above code creates 3 textboxes in a row. When I check the HTML
Source, table rows are not created, so when I hit the server (asp.net
and c#), the row count is 0. Is this the right way to create a row or
any other method is available?


Thanks in advance,
achu


[jQuery] refactoring help/ suggestions?

2009-08-09 Thread Calvin

Hi,

I wrote this code for a simple hide and show effect and I am looking
for any advice or examples of how I can refactor the code. I tried
using a hash but it didn't work out right and I am thinking that maybe
I should make a object method.

here is the code:

$(document).ready(function() {
  var $firstPara = $('p.a');
   $firstPara.hide();

  $('a.one').hover(function() {
   $('a.one').fadeOut('slow').fadeIn('slow');

   if ($firstPara.is(':hidden')) {
   $firstPara.fadeIn('slow');
   } else {
  $firstPara.fadeOut('slow');
   }
return false;
});
});

$(document).ready(function() {
  var $secondPara = $('p.b');
   $secondPara.hide();

  $('a.two').hover(function() {
   $('a.two').fadeOut('slow').fadeIn('slow');

   if ($secondPara.is(':hidden')) {
   $secondPara.fadeIn('slow');
   } else {
  $secondPara.fadeOut('slow');
   }
return false;
});
});

$(document).ready(function() {
  var $thirdPara = $('p.c');
   $thirdPara.hide();

  $('a.three').hover(function() {
   $('a.three').fadeOut('slow').fadeIn('slow');

   if ($thirdPara.is(':hidden')) {
   $thirdPara.fadeIn('slow');
   } else {
  $thirdPara.fadeOut('slow');
   }
return false;
});
});


[jQuery] Re: Jquery Remote Message is not showing up

2009-08-09 Thread chobo2

ya that is for php not Asp.net MVC.

The url is right, the problem was the bool I was returning. It
returned False or True where jquery.validate needs to have false
or true in lowercase otherwise it ignores it. Once I figured that
out it all worked.

Field wrote:
 I think you need more than just Test in the remote: call. Look at
 the jquery validation documentation and the examples he's provided.

 For instance, this is my remote:
 remote: {
   url: 
 /rtui/codeigniter/index.php/business_form/dupeCheck,
   type: post,
   data: {
   action: function() {
   return 
 $(#action).val();
   },
   bus_id: function() {
   return 
 $(#bus_id).val();
   }
   }
   }

 On Aug 8, 5:41 pm, chobo2 mhub...@gmail.com wrote:
  Hi
 
  I am not sure what I am doing wrong I am using the Jquery.Validate
  plugin and it has a remote field
 
  so I did this
 
  [code]    $(#mainForm).validate(
          {
              rules:
              {
                  UserName:
                  {
                      required: true
                     ,remote: Test
                  }
               ,messages:
              {
                  UserName:
                  {
                      remote: UserName has already been choosen. Please
  choose another one
                  }
              }
 
           }
  [/code]
  the required works fine. It's the remote. I am using asp.net mvc and
  the path is right it hits my method
 
         [code] public bool Test(string userName)
          {
              return false;
          }
  [/code]
 
  it returns false according to firebug yet jquery.validate does not
  kick in. I am using Version 1.5.5 of jquery.validate and jquery 1.3.2
 
  What did I miss?
 
  P.S what is the default message for remote?


[jQuery] Re: getJSON response limit

2009-08-09 Thread thephatp

Well, the response actually returns, but the jQuery code doesn't
execute.  I've isolated the problem--I have a field in the database
that stores general instructions that can be entered by a user.  There
is a carriage return for new-lines in the text that is captured.  When
one of these entries is returned, jQuery will not parse the JSON
correctly.  For example, here is my code:

jQuery.getJSON( datapages/getSummary.php , function( 
json ) {
alert( json:  + json );
jQuery.each( json.results , function( i , item 
) {
_SUMMARY.push( item );
WriteSummary( item , count );
++count;
});
});


When I request all of the summaries, I never see the alert.  When I
request only a small set of entries at a time (via the DB call using
`LIMIT x,n`), I see the alert statement when I do NOT have a response
that contains the newline character (\n I'm assuming).  As soon as the
data set response contains a newline, I no longer see the alert and
the processing stops.  Other than the obvious answer of not allow
newline characters (my end product would be pretty lame), is there
anything else I can do?

Any ideas?

Thanks,

Chad


On Aug 9, 12:33 pm, Michael Geary m...@mg.to wrote:
 There is no set limit on the size of a JSON response, any more than there is
 on an HTML or XML response. You can have very large JSON responses with no
 problem.

 GET vs. POST would have nothing to do with this. Those are only different in
 the way the request is sent to the server; the response format for GET and
 POST is identical.

 When you say it fails, what fails? Is the server failing to generate a
 complete JSON response? Is it being generated OK but running into trouble in
 the browser? What exactly is failing and how?

 -Mike

  From: thephatp

  I'm employing the getJSON call in a site I'm working on, but
  I'm having a problem with the response not coming through if
  it is too large.

  I've read a number of posts talking about the request string
  being too large (forcing a user to use POST), but what about
  the response string being too large?  Would switching to POST
  fix this?

  The data coming back could be broken down into smaller
  portions and requested separately, but this seems like way
  overkill for what I'm needing to do, not to mention that it's
  a nightmare trying to get it all to return in the correct
  order (since some later requests complete before the most recent one).

  My current test is requesting about 50 objects (each with
  about 20 fields), but it fails after about 10 (scarcely
  populated) objects.  As an alternative, I grabbed all 50 id's
  to the objects (in MySQL database), and then proceeded to
  request each one individually.
  However, since the request is asynchronous, I'm getting what
  should be ordered results back, which isn't good.

  So, I see two alternatives:

  (1) Find a way to request all the data up front in a single
  call (very preferable).

  (2) Request each one individually as described above, and
  store the values in a new javascript class, then re-order
  afterward.  This seems like overkill, and I hope I don't have
  to go here.

  Does anyone have any suggestions for #1 above or even another
  alternative solution?  I'm all ears (or eyes in this case).

  Thanks in advance for any help you can provide!

  Chad


[jQuery] Using :first and :last on the first children of an element

2009-08-09 Thread Alec

I have some simple tables with multiple tr rows. The td cells
within these rows have tables of their own. I'm trying to target the
tr rows of the first (parent) tables, like so (excuse the spacing):

HTML:

table class=parent
  tr -- match with :first
td
  table
trtd/td/tr
trtd/td/tr
  /table
/td
  /tr
  tr -- match with :last
td
  table -- ignore this child
trtd/td/tr
trtd/td/tr -- so do NOT match this with :last
  /table
/td
  /tr
/table

jQuery:

$('table.parent').each(function() {
  $(this).find('tr:first').dostuff();
  $(this).find('tr:last').dostuff();
});

The :first tr works fine, since that's always the tr of the
parent. But when I try to select the :last tr, it'll match the last
tr of the nested table, and not the last tr of the parent table.

How can I tell jQuery to only look at the trs that are in the parent
table, and don't search any further in children tables?

Thanks in advance for your help!


[jQuery] Re: New to jquery, multiple .js files not running

2009-08-09 Thread Stephan Beal

On Aug 9, 7:38 pm, andrew.croce andrew.cr...@gmail.com wrote:
 What I was trying to do with  var current_section = $(this).attr
 (name); was to create a variable that simply contained the name of
 the particular subsection, which I could then attach to _tab to
...
 idea, could that be screwing up the whole file? or is the name
 attribute inaccessible to jquery?

i see. No, it's not a bad idea, i was just confused by it.

 The bigger problem, it seems, is that nothing is running in that
 gallery.js file, not even the first few lines...
         $(.current_panel .image_area).removeClass(current_area);
         $(.current_panel .image_area).hide();
         $(.current_panel .intro).show();
         $(.current_panel .intro).addClass(current_area);
         $(.back_tab).hide();

If you haven't done so yet, install Firebug and enable it for your
page. Then click the Script -- Break on all Errors option and
reload your script. If there's a syntax error or something which is
causing an silent failure, this will normally point you directly to
it. Other than that, i don't have any tips.

 class .current_panel is added when a main menu btn is clicked, and the
 script for that is in the other panels.js file, which, as I said, is
 running perfectly. If all the javascript on the site is run on page
 load, then there is no .current_tab class at the time, and hence
 nothing will happen.

That's right - selectors match only what's currently in the dom at the
moment (but the new livequery API can also catch future matches). It
sounds like you've found the problem.


[jQuery] Re: more VALIDATION issues

2009-08-09 Thread Jörn Zaefferer

Your assumption that the remote method is buggy is not at all
verified, or: wrong. Instead of trying to write your own
remote-method, please provide a testpage to find the actual issue
you're dealing with.

Jörn

On Sun, Aug 9, 2009 at 7:07 PM, Miket3miketro...@gmail.com wrote:

 OK.  the validation plugin is kicking my ass. as does every new thing
 I try to learn.

 FIRST: I need to clarify that there is a BUG up front so someone
 doesn't offer it as a solution.
 I am using version 1.5.5. It has a bug in the REMOTE rule/method so
 this is not an option to check for duplicate entries. And I know this
 because I set my lookup.php server script to a single line of ECHO
 FALSE but the validator plugin still adds a valid to the element
 class. Plus this was an issue in previous releases so it is more than
 likely re-introduced. BUT if you think I am still wrong I am open to
 suggestions so long a s they are detailed.

 So with that issue behind me I went out and learned how to create a
 custom method using the $.validator.addMethod() to solve my problem.
 And now I have run into 2 more issues which are stopping me. If
 someone can solve any 1 of these next 2 issues, I can be on my way.

 1. I don't know how to grab a value returned from $.get() and put it
 into a javascript variable that can be used outside the scope of the
 $.get() event because I need to return that value .  I have tried
 setting global variables all over the place but nothing gets set.

 2. I also tried to just add an attribute to the element with the
 return value, then use jquery to fetch that value. But there seems to
 be a cache issue along the way. The attrib is being set correctly
 (according to firebug) but the value is always 1 cycle behind. Oh...
 and I do have CACHE:FALSE set.

 so if anyone can help here is my code:

 $.validator.addMethod(dupcheck,function(value,element){

    var lookupkey = $(element).attr(name);
    var lookupvalue = $(element).val();
    var thisid = $(element).attr(id);
    var valid_img = 'img src=/global_libs/images/icons/
 checked.gif';
    var error_img = 'img src=/global_libs/images/icons/
 unchecked.gif';

    $.get('lookup.php', {table : members, key : lookupkey, value :
 lookupvalue, successmsg:false, failmsg:true }, function(data){  [I
 NEED THE VALUE OF (DATA) TO BE RETURNED FROM HERE]  });
 });

 ok I will through in the server script as well:

 here is my LOOKUP.PHP
 ?

 $noheaders = true;  //prevents config.php from loading any header
 data such a scripts and styles.
 include(config.php);
 $table = $_GET[table];
 $key = $_GET[key];
 $value = $_GET[value];
 $failmsg = (isset($_GET[failmsg]) ? $_GET[failmsg] : $value.: Not
 Found in TABLE: .$table. for KEY: .$key);
 $successmsg = (isset($_GET[successmsg]) ? $_GET[successmsg] :
 $value.: Found in TABLE: .$table. for KEY: .$key);
 $sql=SELECT * FROM $table WHERE $key='$value' ;
 $result=mysql_query($sql);
 if (mysql_num_rows($result)  0) {
  echo $successmsg;
 } else {echo $failmsg;  };

 ?

 Thanks,
 MIke



[jQuery] Re: Regular Expression validation

2009-08-09 Thread Karl Swedberg

Hi KeeganWatkins,

Here is what the OP (nouky) wrote:
I would like to validate a textbox that numbers cannot be entered  
into the text input



That sounds to me like he doesn't want any numbers to be allowed  
anywhere within the value.


I'm interested to hear why you think /[^\d]/g is more elegant that !/\d/

If the point is to disallow numbers, you don't need to use the global  
flag. As soon as the regex comes across the first number, the test  
should return false, right? No sense continuing.


Also, have you tried your regular expression? Paste this into  
Firebug: /[^\d]/g.test('I have 3 eggs');


It returns true (when it shouldn't).

I suppose you could do something like this:

/^\D*$/.test(textareaValString)

but I don't see how that is more elegant either.


The only other difference I see between our solutions is that you  
store the result of the regex test in a variable and use that variable  
as the condition. But that part is irrelevant to what I was saying to  
Michael.


Am I missing something, or have we interpreted the OP's request  
differently?


--Karl


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




On Aug 9, 2009, at 2:19 AM, KeeganWatkins wrote:



With all due respect, I think karl's solution is somewhat less than
elegant, and could be improved by refactoring to:

// test for anything but numbers
var isValid = /[^\d]/g.test(textareaValString);

if (isValid) {
   // proceed with confidence
} else {
   // note to user: no numbers allowed!
}

On Aug 8, 11:13 pm, Karl Swedberg k...@englishrules.com wrote:

On Aug 7, 2009, at 2:53 PM, Michael Lawson wrote:


yes, you can grab the value of the textbox and match it against a
regular expression
var reg = new RegExp(/[a-zA-Z]/);
if(reg.test(string))
{
return valid;
}
else
{
return not valid;
}


Hey Michael,

I don't think that regular expression is going to work. If you're
using a regular expression constructor method, as opposed to a
literal, you shouldn't use the slashes. Even without the slashes,  
that

test will always return true as long as the string has one upper or
lower case letter from a to z.

The OP wanted to disallow numbers, so this should do it:

if ( !(/\d/).test(string) ) {
   return 'valid';} else {

   return 'not valid';

}

--Karl


Karl Swedbergwww.englishrules.comwww.learningjquery.com




[jQuery] Re: Detect Capital Letters

2009-08-09 Thread Karl Swedberg
haha, you got me! so, yeah, it would be a bit more work. point  
taken! :-p


--Karl


On Aug 9, 2009, at 1:55 PM, Michael Geary wrote:


That would work for you and for me, but would it work for everyone?

alert( isUpperCase('JÖRN') ? 'good' : 'bad' );  // ;-)

-Mike

From: Karl Swedberg
Shouldn't be too much work. Wouldn't this do it?

function isUpperCase( string ) {
return /^[A-Z]+$/.test(string);
}
On Aug 8, 2009, at 8:34 PM, Michael Geary wrote:

If you want to check that the string contains *only* uppercase  
characters
and no case-less characters (so that ABC would return true but  
A B C

would return false), that would be a bit more work.




[jQuery] Re: getJSON response limit

2009-08-09 Thread thephatp

I used json_encode in php to escape the new-lines and all works great
now!


[jQuery] Re: New to jquery, multiple .js files not running

2009-08-09 Thread andrew.croce

Thanks for your replies, I appreciate it.

I put the contents of gallery.js inside the click function and it
appears to be working now.  I had tried this before, but there must
have been an unrelated syntax error or something that was causing it
to break.

Thanks
Andrew

On Aug 9, 4:45 pm, Stephan Beal sgb...@googlemail.com wrote:
 On Aug 9, 7:38 pm, andrew.croce andrew.cr...@gmail.com wrote:

  What I was trying to do with  var current_section = $(this).attr
  (name); was to create a variable that simply contained the name of
  the particular subsection, which I could then attach to _tab to
 ...
  idea, could that be screwing up the whole file? or is the name
  attribute inaccessible to jquery?

 i see. No, it's not a bad idea, i was just confused by it.

  The bigger problem, it seems, is that nothing is running in that
  gallery.js file, not even the first few lines...
          $(.current_panel .image_area).removeClass(current_area);
          $(.current_panel .image_area).hide();
          $(.current_panel .intro).show();
          $(.current_panel .intro).addClass(current_area);
          $(.back_tab).hide();

 If you haven't done so yet, install Firebug and enable it for your
 page. Then click the Script -- Break on all Errors option and
 reload your script. If there's a syntax error or something which is
 causing an silent failure, this will normally point you directly to
 it. Other than that, i don't have any tips.

  class .current_panel is added when a main menu btn is clicked, and the
  script for that is in the other panels.js file, which, as I said, is
  running perfectly. If all the javascript on the site is run on page
  load, then there is no .current_tab class at the time, and hence
  nothing will happen.

 That's right - selectors match only what's currently in the dom at the
 moment (but the new livequery API can also catch future matches). It
 sounds like you've found the problem.


[jQuery] Sluggish innerfade transition in new browser versions

2009-08-09 Thread ferdjuan

I'm using jQuery 1.3.2 and the latest version of the Innerfade plugin:
http://medienfreunde.com/lab/innerfade/ I'm transitioning through 8
large images (1024x368) with the fade option. With Safari 4.0.2 the
transition is very sluggish, making it look like it's running about 5
fps. With Firefox 3.03 it looked great, as the plugin normally does
with smaller images. I upgraded to Firefox 3.5 and now the transition
looks just as bad in FF as Safari. Has anyone come across this and has
any solution? Thanks


[jQuery] Re: Simplemodal ajax dialog

2009-08-09 Thread Eric Martin

Michael,

You need to initialize any third party scripts in the SimpleModal
onShow callback. Here's an example of using Datepicker with
SimpleModal:
http://www.ericmmartin.com/code/datepicker/

-Eric

On Aug 7, 2:34 am, Michael Anckaert michael.ancka...@gmail.com
wrote:
 Hello everyone,

 Using the simplemodal plugin I create a dialog dynamically from links
 using

 $(.dialog-link).live('click', function(e) {
                         e.preventDefault();
                         $.get($(this).attr('href'),function(data) {
                                 $.modal(data, {onOpen: open, position: 
 ['10%','30%']});
                         });
                 });

 (FYI: the onOpen callback just sets some height)

 The document returned by the ajax call (contained in data) has some
 jquery calls to datepicker, etc. But when my dialog displays the
 datepicker won't work. As far as I can tell the javascript in the
 document called with AJAX isn't executed, but I do get my alert() test
 statements...

 Does anyone know where my error lies?

 Thanks,
 Michael


[jQuery] Re: tablesorter help?

2009-08-09 Thread jsrobinson

Doh! That was the one parameter I didn't experiment with to see where
the problem was...

Thank you!

On Aug 7, 5:09 am, Paul Mills paul.f.mi...@gmail.com wrote:
 Hi,
 Change the sortList definition to
 sortList: [[3,0]],
 or
 sortList: [[3,1]],
 depending on what order you want the column sorted in.

 You could also tidy up your HTML by adding tbody/tbody tags and
 form elements are not valid inside tr/tr

 Paul

 On Aug 7, 6:53 am, jsrobinson magiclampnetwo...@gmail.com wrote:



  I have two custom parsers, one works on one column but not on another.
  The second parser is working fine.

  Example:

 http://jquery.magiclamp.net/tablesorter.html

  Cols 2 and 3 have the exact same data, use the same parser, and yet
  sorting on col 2 works but sorting on col 3 returns

  Sorting on 3,NaN and dir NaN time:,3ms
  Rebuilt table:,1ms

  Any clues?

  Thank you for an awesome plugin!!!


[jQuery] Re: [ANNOUNCEMENT] jQuery LargePhotobox plugin

2009-08-09 Thread Rick Faircloth

Good job!

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Alexsandro_xpt
Sent: Sunday, August 09, 2009 11:43 AM
To: jQuery (English)
Subject: [jQuery] [ANNOUNCEMENT] jQuery LargePhotobox plugin


Hi everyone,

Yesterday I released the first public release of my
jquery.largephotobox plugin.

I've posted it on the google code page:
http://code.google.com/p/jquery-largephotobox/

Demo page:
http://www.interag.net/largephotobox



[jQuery] Multi-Purpose MySQL Lookup Script inside

2009-08-09 Thread Miket3

I have been struggling with the validation plugin for a while. And I
finally got it to work.  As a result I created a multi-purpose lookup
script.  I hope this comes in handy for someone else. This script can
be used for the validation plugin or for returning field values back
to your jquery event. The script is quite short and I provided some
documentation and examles below the code. It is only meant to find 1
record, but you can enhance for your needs.


LOOKUP.PHP
?
include(config.php);

$table = $_POST[table];
$key = $_POST[key];
$value = $_POST[value];
$failmsg = (isset($_POST[failmsg]) ? $_POST[failmsg] : $value.:
Not Found in TABLE: .$table. for KEY: .$key);
$successmsg = (isset($_POST[successmsg]) ? $_POST[successmsg] :
$value.: Found in TABLE: .$table. for KEY: .$key);
$fields =  (isset($_POST[return_fields]) ? $_POST[return_fields] :
*);


$sql=SELECT $fields FROM $table WHERE $key='$value' ;
$result=mysql_query($sql);

if (mysql_num_rows($result)  0) {
  if ($fields == *) {
print_r($successmsg);
  } else {
$successmsg = mysql_fetch_assoc($result);
print_r(data=.json_encode($successmsg));
  }
} else {echo $failmsg;  };

?


?
/*
This lookup file is a multi-purpose lookup function.
It is meant to work with a POST transaction.
This file makes the assumption that you already have a DB CONNECTION.
I make my connection in CONFIG.PHP

There are 3 mandatory parameters that need to be set prior to the
POST.
TABLE  is mandatory.We need to know which table to perform the
lookup on.
KEYis mandatory.We need to know which fieldname we will be
searching on.
VALUE  is mandatory.We need to know what we are looking or in the
KEY field.
FAILMSG is optional.Unless you are using this function for
validation. see VALIDATION below.
SUCCESSMSG is optional. Unless you are using this function for
validation. see VALIDATION below.
FIELDS is optional. If you set this to anything but * it will
override the SUCCESSMSG
and return the results as a JSON encoded
string.
If you send comma delimited string of field
names.
There are 3 options for this paramter.
1. Dont send it at all.
2. Send it as *, which is same as not
sending it.
3. Send a comma delimited string of valid
field names.

USING IT FOR VALIDATION
When using it to check for duplicate values with jquery validation
plugin...
You want to have the incoming msg parameters set as (failmsg =
true , successmsg = false)
Its a little reverse logic because when you are checking for
duplicates you really dont want to find anything.
EXAMPLE:
USERNAME check for duplicates. useful for registration form.
  var validator = $(#myform).validate({
rules: {
username: {required: true,
   minlength: 4,
   remote: {url:lookup.php,
type : post,
data: {table:members,
failmsg:true,
successmsg:false,
key:username,
value:function(){return $(#username).val
(); }
   }
   }
},
messages: {
   username: {required: Enter a username,
  minlength: jQuery.format(Enter at least
{0} characters),
  remote : it already exists
  }
},
[MORE VALIDATION RULES GO HERE]
  });



USING IT FOR RETURNING DATA
You can also use this function to lookup a key value and return field
values as a JSON encoded string.

EXAMPLE:
ZIP CODE LOOKUP - User enters ZIPCODE and we populate the CITY and
STATE.
IMPORTANT!: This example assumes that the ZIPCODE field name is
identical in your current form/table and the ZIPCODES table.
otherwise LOOKUPKEY would have to be set manually.
$(#zipcode).blur(function(){
   var lookupkey = $(this).attr(name);
var lookupvalue = $(this).val();
var valid_img = 'img src=/global_libs/images/icons/
checked.gif';
var error_img = 'img src=/global_libs/images/icons/
unchecked.gif';
$.post('lookup.php', {table : zipcodes, key : lookupkey, value :
lookupvalue, return_fields : city,state }, function(data){
   eval(data);
   $(#city).val(data.city);
   $(#state).val(data.state);
});
});



*/
?


[jQuery] gallery question

2009-08-09 Thread Cyra

Hello,

First time posting here, so sorry if this has been covered to death,
but I couldn't find anything via searching.

I'm building a gallery page, that's setup like this:

- carousel based horizontal image thumbnail navigation.

- main div that loads, on thumbnail click, a high res version of each
thumbnail image that exists within the carousel nav.

so basically:

code

div id=main_div
!-- high res image will be loaded here via ajax --
/div

div id=carousel
ul
lia class=thmb1 href=###img src=item1.jpg //a/li
lia class=thmb2 href=###img src=item2.jpg //a/li
lia class=thmb3 href=###img src=item3.jpg //a/li
/ul
/div

/code



now, i realize i could simply write a line of jquery to load each and
every thumbnail, i.e.

code
$(#carousel ul li a.thmb1).click(function () {

$(#main_div).load(/high_res_images.html #image1);

});
/code

but that seems incredibly innefficient, and might be too complicated
for my non-technical client to maintain.

I'm wondering if I could set something up using the 'this' keyword, or
'each' to make this much more efficient, and would allow me to add new
items to the carousel without updating the code.

thanks so much for reading, i realize this is probably simpler than I
think it is, but I'm new to js and jquery (loving it so far though!)

-matt


[jQuery] jquery + cycle + IE

2009-08-09 Thread nspace

Having a bit of an issue with my setup with jQuery + Cycle

http://negativespace.ca/clients/mirrorbuilder/

There are two divs that control the photos, #controller, and #prevNext
which has two href's in it that link to #next and #prev anchors like
in the demos from the Cycle website.

I am using the Cycle pager technique like this:

script type=text/javascript

$('#slideshow')
.before('div id=controller')
.cycle({
fx: 'scrollHorz',
speed: 'fast',
timeout: 0,
pager: '#controller',
next: '#next',
prev: '#prev'
});

/script

Works fine in Safari and Firefox so far, but for whatever reason, both
of those controllers will not show up in IE6 or IE7. I am a little bit
stumped.


[jQuery] simple question regarding the 'this' keyword

2009-08-09 Thread Cyra

Hello,

First time posting here, so sorry if this has been covered to death,
but I couldn't find anything via searching.

I'm building a gallery page, that's setup like this:

- carousel based horizontal image thumbnail navigation.

- main div that loads, on thumbnail click, a high res version of each
thumbnail image that exists within the carousel nav.

so basically:

code

div id=main_div
!-- high res image will be loaded here via ajax --
/div

div id=carousel
ul
lia class=thmb1 href=###img src=item1.jpg //a/li
lia class=thmb2 href=###img src=item2.jpg //a/li
lia class=thmb3 href=###img src=item3.jpg //a/li
/ul
/div

/code



now, i realize i could simply write a line of jquery to load each and
every thumbnail, i.e.

code
$(#carousel ul li a.thmb1).click(function () {

$(#main_div).load(/high_res_images.html #image1);

});
/code

but that seems incredibly innefficient, and might be too complicated
for my non-technical client to maintain.

I'm wondering if I could set something up using the 'this' keyword, or
'each' to make this much more efficient, and would allow me to add new
items to the carousel without updating the code.

thanks so much for reading, i realize this is probably simpler than I
think it is, but I'm new to js and jquery (loving it so far though!)

-matt




[jQuery] Conditional form element with dropdown box

2009-08-09 Thread maple1249

Hello,

I have been searching for a few days a way to have a form element
slide down ONLY IF a certain option in the dropdown is selected. I
have found resources using radio boxes and check boxes, but none with
dropdowns.

Thanks!


[jQuery] Re: getJSON response limit

2009-08-09 Thread cfddream
url : 
datapages/getSummary.php?callback=?
 
--
Ever
 Now
 ..




 
 
 

-- Original --  


From:  thephatpchad.a.mor...@gmail.com;
Date:  2009年8月10日(星期一) 凌晨4:16
To:  jQuery 
(English)jquery-en@googlegroups.com; 

Subject:  [jQuery] Re: getJSON response limit

 

Well, the response actually returns, but the jQuery code doesn't
execute.  I've isolated the problem--I have a field in the database
that stores general instructions that can be entered by a user.  There
is a carriage return for new-lines in the text that is captured.  When
one of these entries is returned, jQuery will not parse the JSON
correctly.  For example, here is my code:

jQuery.getJSON( datapages/getSummary.php , function( json ) {
alert( json:  + json );
jQuery.each( json.results , function( i , item ) {
_SUMMARY.push( item );
WriteSummary( item , count );
++count;
});
});


When I request all of the summaries, I never see the alert.  When I
request only a small set of entries at a time (via the DB call using
`LIMIT x,n`), I see the alert statement when I do NOT have a response
that contains the newline character (\n I'm assuming).  As soon as the
data set response contains a newline, I no longer see the alert and
the processing stops.  Other than the obvious answer of not allow
newline characters (my end product would be pretty lame), is there
anything else I can do?

Any ideas?

Thanks,

Chad


On Aug 9, 12:33?pm, Michael Geary m...@mg.to wrote:
 There is no set limit on the size of a JSON response, any more than there is
 on an HTML or XML response. You can have very large JSON responses with no
 problem.

 GET vs. POST would have nothing to do with this. Those are only different in
 the way the request is sent to the server; the response format for GET and
 POST is identical.

 When you say it fails, what fails? Is the server failing to generate a
 complete JSON response? Is it being generated OK but running into trouble in
 the browser? What exactly is failing and how?

 -Mike

  From: thephatp

  I'm employing the getJSON call in a site I'm working on, but
  I'm having a problem with the response not coming through if
  it is too large.

  I've read a number of posts talking about the request string
  being too large (forcing a user to use POST), but what about
  the response string being too large? ?Would switching to POST
  fix this?

  The data coming back could be broken down into smaller
  portions and requested separately, but this seems like way
  overkill for what I'm needing to do, not to mention that it's
  a nightmare trying to get it all to return in the correct
  order (since some later requests complete before the most recent one).

  My current test is requesting about 50 objects (each with
  about 20 fields), but it fails after about 10 (scarcely
  populated) objects. ?As an alternative, I grabbed all 50 id's
  to the objects (in MySQL database), and then proceeded to
  request each one individually.
  However, since the request is asynchronous, I'm getting what
  should be ordered results back, which isn't good.

  So, I see two alternatives:

  (1) Find a way to request all the data up front in a single
  call (very preferable).

  (2) Request each one individually as described above, and
  store the values in a new javascript class, then re-order
  afterward. ?This seems like overkill, and I hope I don't have
  to go here.

  Does anyone have any suggestions for #1 above or even another
  alternative solution? ?I'm all ears (or eyes in this case).

  Thanks in advance for any help you can provide!

  Chad

[jQuery] Re: getJSON response limit

2009-08-09 Thread MorningZ

GET vs. POST would have nothing to do with this

Sure it could.

http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html

Granted i do not know if newer browser versions have raised or removed
that cap, but it's still something to consider


To original poster:  it would take a minute to switch from $.getJSON
and it's default GET behavior to the more generic $.ajax() method and
setting method to POST


[jQuery] Re: getJSON response limit

2009-08-09 Thread Michael Geary

You're giving the right answer to the wrong question. ;-)

Chad's question had nothing to do with limits on GET parameters or the
maximum length of a URL. The parameters were making it to the server just
fine.

The question was about any possible limits on the *response*. This wouldn't
be affected by the use of GET vs. POST.

The answer turned out to be that the server code wasn't using a proper JSON
encoder, so it was leaving newlines inside strings in the JSON response,
which of course broke it.

-Mike

 From: MorningZ
 
 GET vs. POST would have nothing to do with this
 
 Sure it could.
 

http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-
parameters.html
 
 Granted i do not know if newer browser versions have raised 
 or removed that cap, but it's still something to consider
 
 
 To original poster:  it would take a minute to switch from 
 $.getJSON and it's default GET behavior to the more generic 
 $.ajax() method and setting method to POST
 



[jQuery] jquery Cycle - number pager doubles with AJAX refresh

2009-08-09 Thread ppblaauw

When using a number pager with the cycle plugin and somewhere else on
the same page a block which refreshes content with AJAX the number
pager for the cycle block doubles.

On the next Ajax refresh it doubles again.
Anyone a solution to prevent the number pager to double.

When I have the number pager items predefined it works ok, but in some
occasions I don't know the amount of pager Items beforehand, so I want
to use the cycle plugin to create the pager items for these slides.

Thanks in advance.

Philip Blaauw



[jQuery] Sloppy Documentation of Ajax Methods

2009-08-09 Thread rickoshay

Here are the descriptions for the Ajax methods:

load -- Loads HTML from a remote file ...
ajax -- Load a remote page ...
get -- Load a remote page...
getScript -- Load and execute a local javascript file...
post -- Load a remote page...

So, if we want arbitrary HTML we have to use load, but if we want a
whole page (where is that defined?)  we have to use ajax, get or
post?

The execute script function (called getScript for some reason) only
works with local files? I believe it will work with any URI (local
or remote) returning JavaScript (assuming same origin policy of
course), and whether it came from a file isn't known to the caller.

These functions should describe the type of HTTP request they make,
and skip references to pages and files.




[jQuery] Re: getJSON response limit

2009-08-09 Thread rickoshay

I guess the surprise was his alert *appeared* to be dependent on the
response size, and of course he did not get an error message.



[jQuery] Re: calling a jQuery function from RJS/onclick

2009-08-09 Thread Ram

anyone? any ideas at all??

On Aug 7, 4:38 pm, Ram yourstruly.vi...@gmail.com wrote:
 Hi,

 Im using jNice (a jQuery plugin) in rails. I have the following jQuery
 function on the head of my page.

 script type=text/javascript
                 jQuery.noConflict();

                 /* calling jNice on document ready */
                 jQuery(document).ready(function($)
                 {
                         $('div.jNice').jNice();
                 });
 .
 /script

 On page load, this gets called correctly.

 Now there's a link on the page that lets me add more rows and i do
 this viaRJS. Here's the code.

 tr id=empty_item
     div  id=plussign%= add_item_link + %/div
 /tr

 def add_item_link(name)
    link_to_function name do |page|
      page.insert_html :before, :empty_item, :partial='item', :object
 = Item.new
    end
 end

 Now this partial 'item' contains form elements upon which jNice needs
 to work its magic.

 How can I call the jNice function after the user clicks on the
 add_item_link?
 Thanks.


[jQuery] Re: Sloppy Documentation of Ajax Methods

2009-08-09 Thread Shawn


ALL the functions (load, get, post, etc) are wrappers for the $.ajax() 
function.  I only use $.ajax() now and tweak it to meet my needs... 
Makes for less confusion.


Ajax by default will only load files that are in the same domain as the 
calling page.  This is a browser security feature.  (Use $.ajax() and 
jsonp to work around that.)  So the getScript() function will follow 
this limitation as well if it is calling the new script via Ajax.


My thoughts.

Shawn

rickoshay wrote:

Here are the descriptions for the Ajax methods:

load -- Loads HTML from a remote file ...
ajax -- Load a remote page ...
get -- Load a remote page...
getScript -- Load and execute a local javascript file...
post -- Load a remote page...

So, if we want arbitrary HTML we have to use load, but if we want a
whole page (where is that defined?)  we have to use ajax, get or
post?

The execute script function (called getScript for some reason) only
works with local files? I believe it will work with any URI (local
or remote) returning JavaScript (assuming same origin policy of
course), and whether it came from a file isn't known to the caller.

These functions should describe the type of HTTP request they make,
and skip references to pages and files.




[jQuery] JQuery lightbox plugin through we can show flash in overlay..

2009-08-09 Thread Amit





Hi 

Is there any jQuery light box plugin by which I can make my flash look
in the overlay window. 

I had searched for one named fancyZOOM .js but don't know why it is not working
for multiple flash in a single page. 

any body having any idea pls reply .. I am struck here.

thanks 














Regards, 
Amit Kr. Sharma