[jQuery] which submit button was clicked?

2009-09-15 Thread badtant

Hi!

I have a submit-event attached to my form. The form contains a few
different submit-buttons and I wan't to chech which one of them that
triggered the submit. Shouldn't be to hard but i can't find out how to
do it.

Thanks


[jQuery] Re: Intercept javascript event

2009-09-15 Thread sirrocco

AOP is not really the answere here. As you can see there is a callback
function - so the user presses some other buttons and then I have to
replay the initial button's onclick functions.

On Sep 15, 3:12 am, Steven Black ste...@stevenblack.com wrote:
 One idea: have a look at the Aspect Oriented Programming plugin.

 Seehttp://plugins.jquery.com/project/AOP
 andhttp://code.google.com/p/jquery-aop/

 If this isn't exactly what you are looking for, then therin is code to
 pre- and post-hook existing events.

 I hope this helps.

 **--**  Steve

 On Sep 14, 1:05 pm, sirrocco xavier...@gmail.com wrote:

  Here's what I'm trying to do :

  I have a page with some links. Most links have a function attached to
  them on the onclick event.

  Now, I want to set a css class to some links and then whenever one of
  the links is clicked I want to execute a certain function - after it
  returns , I want the link to execute the onclick functions that were
  attached to it.

  Is there a way to do what I want ?

  Here's an attempt at an example :

  $(#link).click(function1);
  $(#link).click(function2);
  $(#link).click(function(){
     firstFunctionToBeCalled(function (){
        // ok, we're inside the callback - now execute function1 and
  function2
     });

  }); // somehow this needs to be the first one that is called

  function firstFunctionToBeCalled(callback){
      // here some user input is expected so function1 and function2
  must not get called
      callback();

  }

  All this is because I'm asked to put some confirmation boxes (using
  boxy) for a lot of buttons and I really don't want to be going through
  every button.


[jQuery] Get the onclick method of an element

2009-09-15 Thread sirrocco

Let's say you have a :

a href=# onclick='DoSomething(this);'asd/a

I want to get the onclick text in a variable - something like

var onclick = $('a').attr('onclick');

The problem is that the onclick variable now is a function and if I
try to execute , this   wil be the document instead of the link .

How can I get only the text, so I can later reattach it to the link ?


[jQuery] Re: Get the onclick method of an element

2009-09-15 Thread MiKiTiE

You will need to use the text() attribute to do this.

so, once you do:

var onclick = $('a').attr('onclick');

You then place it where you want this way:

$(a).text(onclick);

However, if you have several links on a page it will be better to
assign it to an id. Plus, since onclick is a javascript handler I'm
thinking it may be better to use a different phrase as your variable
to avoid confliction.

Mike


On Sep 15, 9:09 am, sirrocco xavier...@gmail.com wrote:
 Let's say you have a :

 a href=# onclick='DoSomething(this);'asd/a

 I want to get the onclick text in a variable - something like

 var onclick = $('a').attr('onclick');

 The problem is that the onclick variable now is a function and if I
 try to execute , this   wil be the document instead of the link .

 How can I get only the text, so I can later reattach it to the link ?


[jQuery] Re: Get the onclick method of an element

2009-09-15 Thread MiKiTiE

Sorry I should have written

$('a').attr('onclick',onclick);

(setting the attribute value not the inner text!)

On Sep 15, 9:09 am, sirrocco xavier...@gmail.com wrote:
 Let's say you have a :

 a href=# onclick='DoSomething(this);'asd/a

 I want to get the onclick text in a variable - something like

 var onclick = $('a').attr('onclick');

 The problem is that the onclick variable now is a function and if I
 try to execute , this   wil be the document instead of the link .

 How can I get only the text, so I can later reattach it to the link ?


[jQuery] Re: Get the onclick method of an element

2009-09-15 Thread sirrocco

Well .. that's the problem - i tried it like that and it didn't work.

When setting the attribute back on the link, the this in DoSomething
(this); is not the link, but the window.

On Sep 15, 11:41 am, MiKiTiE mikiji...@googlemail.com wrote:
 Sorry I should have written

 $('a').attr('onclick',onclick);

 (setting the attribute value not the inner text!)

 On Sep 15, 9:09 am, sirrocco xavier...@gmail.com wrote:

  Let's say you have a :

  a href=# onclick='DoSomething(this);'asd/a

  I want to get the onclick text in a variable - something like

  var onclick = $('a').attr('onclick');

  The problem is that the onclick variable now is a function and if I
  try to execute , this   wil be the document instead of the link .

  How can I get only the text, so I can later reattach it to the link ?




[jQuery] Very disappointed with jquery and iframe communication

2009-09-15 Thread ximo wallas
After 1 day googling and trying I find no agreement in a solid method for 
comunicating with iframe, this is the nearest point I've been to get in touch 
with IFRAME:

$(frames['Theiframe']).ready( function () 
{
    alert('Frame is loaded');

});

This will alert the message, but any attempt to comunicate with the iframe and 
access it's contents have been useless, I have a hidden field with with ID 
login and I'm trying to get it's value:

$(frames['Theiframe']).find(#login).val(); //Doesn't work in FF 3.0.14

/

var $currentIFrame = $(frames['Theiframe']);
$currentIFrame.contents().find(body #login).val() //Neither does in FF 3.0.14

If you Google a few you will see that everyone is giving it's own opinion on 
how to do it, but there's no agreement and no crossbrowser solid solution...




  

[jQuery] Re: which submit button was clicked?

2009-09-15 Thread bjorsq


Hi,

As far as I can tell, it is not possible to get the details of which submit
button was clicked from the submit event of the form, as the event target
will always be the form element. The way to implement this would be to
assign a class to each submit button, then attach a click event to them,
like this example:

http://jsbin.com/inuha/edit



badtant-2 wrote:
 
 
 Hi!
 
 I have a submit-event attached to my form. The form contains a few
 different submit-buttons and I wan't to chech which one of them that
 triggered the submit. Shouldn't be to hard but i can't find out how to
 do it.
 
 Thanks
 
 

-- 
View this message in context: 
http://www.nabble.com/which-submit-button-was-clicked--tp25449810s27240p25450711.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Iframe - adding and removing hidden form elements

2009-09-15 Thread Benster-


OK got the delete working, here is the final function:

$(document).ready(function(){
 $(':checkbox.addPhoto').click(function(){
if ($(this).attr('checked')) {
// Add element to form
$(#post, 
parent.document.body).append();
} else {
// Delete element from form
$(#post input[id=' + 
$(this).attr('id') + '],
parent.document.body).remove();
}
});
});

-- 
View this message in context: 
http://www.nabble.com/Iframe---adding-and-removing-hidden-form-elements-tp25343500s27240p25450789.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Hide/Show based on radio button selected

2009-09-15 Thread bjorsq


Hi,

In the following example, all the radio controls have the name attribute set
to myradio, and the #offices_checkboxes part of the document is shown
when the radio with id 'radioOne' is checked. Your example probably didn't
work because of the syntax you used in your attribute selector (no @ symbol
is neccessary in the latest jQuery - this would only work in 1.2 and lower)

$(function(){
  $('#offices_checkboxes').hide();
  $('input:radio[name=myradio]').click(function() {
if ($(this).attr(id)==='radioOne') {
  $(#offices_checkboxes).show();
} else {
  $(#offices_checkboxes).hide();
}
  });
});


Rick Faircloth wrote:
 
 
 Just off the top of my head, but may work...
 
 $(document).ready(function() {
 
  $('#offices_checkboxes').hide();
 
  $('input:radio[name=radioName]:checked').click(function() {
   $('#offices_checkboxes').show();
  });
 
  $('input:radio[name=radioName]:not(:checked)'.click(function() {
   $('#offices_checkboxes').hide();
  });
 
 });
 
 This code makes use of the name of the radio button group, as well.
 
 hth,
 
 Rick
 
 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
 Behalf Of mtuller
 Sent: Monday, September 14, 2009 11:14 AM
 To: jQuery (English)
 Subject: [jQuery] Hide/Show based on radio button selected
 
 
 I am trying to create a script that will display content based on if a
 radio button is selected, and if the other is selected would hide the
 content. Now, each of these radio buttons are part of a radio group,
 so their names are the same. Most examples show input:radio
 [...@name=item] Since I have 2 items that have the same name, I can't use
 name, so I thought I would try id or value. It isn't working. If I add
 only the show, whenever you select either radio button, it shows, and
 if I add the hide code, it doesn't work at all.
 
 Here is what I have right now.
 
   $(document).ready(function(){
 $('#offices_checkboxes').hide();
 $(input:rad...@value=1]).click(function() {
 $(#offices_checkboxes).show();
 });
 $(input:rad...@value=0]).click(function() {
 $(#offices_checkboxes).hide();
 });
 
   });
 
 Anybody have an idea of how I could get this to work?
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Hide-Show-based-on-radio-button-selected-tp25437679s27240p25450984.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: jCarousel: restart the carousel

2009-09-15 Thread Lleoun

Hi again,

I have no answer to this post yet, does anyone knows about a jCarousel
forum where  I can post it?
I trully need to fix it and I'm runing out of time to do so.

Thanks a lot!


On Sep 4, 3:12 pm, Lleoun adoming...@vivocom.es wrote:
 Hi all,

 I'm using jCarousel as a video playlist. There's a total of 8 items, 6
 shown at load.
 The playlist plays  item to item in the carousel until the last one.
  Once the last item is played, the first item starts playing again.

 As I need the carousel to scroll to the first item when the playlist
 is restarted I've done:

 $(#playlistInner).css({left : 0px});

 The DOM:
  ul id=playlistInner class=jcarousel-skin-mytv
  lia id=item1 class=playlist_item ..

 And this seems to work, the carousel scrolls to the first item, BUT
 previous button is enabled and when you click on the button the
 carousel  shows the spaces for two empty items.

 Please see the attached image, it shows what 
 happens:http://www.vivocom.es/test/scrollToFirstItem.jpg

 What else do I have to do for the carousel to scroll correctly to the
 first item??

 Thanks a ton in advance!


[jQuery] Re: Help with getting variable

2009-09-15 Thread bjorsq


Hi Dave,

Use a regular expression to split your form element names like this:

var regex = /^(\w+)\[(\w+)\]\[(\w+)\]$/i;
var str = data[User][username];
var matches = regex.exec(str);
// matches[2] now contains user




Dave Maharaj :: WidePixels.com wrote:
 
 
 Hoping for some simple help here.
 
 I have this structure in my forms 
 
 name=data[User][username]
 
 But depending on the form it the ['User'] section will change throught the
 site. How can I pull the User as a variable?
 
 The script has something like this:
 
 $.post('/ajax_validate/users/', {
 field: fieldName,
 value: fieldValue
 },
 
 Where I want to add the variable like
 
 $.post('/ajax_validate/'+myVarHere, {
 field: fieldName,
 value: fieldValue
 },
  
 Thanks,
 
 Dave 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Help-with-getting-variable-tp25429729s27240p25451239.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer

Whats wrong with keeping the focus on the active field, if its invalid?

If you enter something into the, say, third field, hit enter to
submit, then it turns out both that field and another before that are
invalid, why move the focus to a different field?

Jörn

On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com wrote:

 I've been building up my validation using the jquery validation plugin
 but I can't work out how to get a failed validation to default the
 focus to the first invalid input rather than to the last selected
 input.

 If there is no input field selected, when I submit then a failed
 validation will focus the cursor on the first field but if the cursor
 was left in a field and submitted then the focus stays there (if it's
 invalid) rather than jump to the first invalid input.  From what I've
 read and seen, this is the expected behaviour but not what I want.

 Is there a way I can get the first invalid field and set the focus to
 that?

 A demo of what I have built up so far can be seen at
 https://webdev2.otago.ac.nz/oihrn2009/

 All my jquery validation can be found in
 https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js




[jQuery] error in ie7 ie8 only

2009-09-15 Thread Sam Sherlock
js code:
function jLinkCall(e, a, o) {
var jUrl = null, jArgs = null, obTitle = '';
 // console.info('jLinkCall');
// console.info(e);
 // console.info(a);
// console.info($(o).attr('href'));

jUrl = $(o).attr('href') + '';
jUrl = jUrl.replace(/.html/, '');

if($(o).attr('title'))
obTitle = $(o).attr('title');

// block with growl
//$('#body').growlUI('Growl Notification', 'Have a nice day!');
 $('.body').block({
message: 'img src=/img/2-0.gif /',
 css: { border: '1px solid #FFF; background: #FFF;' }})
 $.post('./json.php?p='+jUrl, null, jLinkComplete, json)

// convert the html url to json url
// process the json object
 // oncomplete call jLinkComplete

}

function jLinkComplete(data, status) {
 // console.info('jLinkComplete');
// console.info(data.titleStr);
 // console.info(status);
$('body').attr('class', '').addClass(data.titleStr);
 $('.body').empty().html(data.contentStr).unblock();
init();
}

set up in dom ready
$('.tabs a').live('click', function(event, args) {
 jLinkCall(event, args, this);
event.preventDefault();
event.stopPropagation();
 return false;
});

This is an issue that only is apparent in ie7   8 all works without issue
in other browsers - not ie 6  though (but who cares)  any ideas?


- S


[jQuery] Re: error in ie7 ie8 only

2009-09-15 Thread Sam Sherlock
following up on that when debugging I can continue through the error and it
works as expected.  but with debugging off the process is interrupted
- S


2009/9/15 Sam Sherlock sam.sherl...@gmail.com

 js code:
 function jLinkCall(e, a, o) {
 var jUrl = null, jArgs = null, obTitle = '';
  // console.info('jLinkCall');
 // console.info(e);
  // console.info(a);
 // console.info($(o).attr('href'));

 jUrl = $(o).attr('href') + '';
 jUrl = jUrl.replace(/.html/, '');

 if($(o).attr('title'))
 obTitle = $(o).attr('title');

 // block with growl
 //$('#body').growlUI('Growl Notification', 'Have a nice day!');
  $('.body').block({
 message: 'img src=/img/2-0.gif /',
  css: { border: '1px solid #FFF; background: #FFF;' }})
  $.post('./json.php?p='+jUrl, null, jLinkComplete, json)

 // convert the html url to json url
 // process the json object
  // oncomplete call jLinkComplete

 }

 function jLinkComplete(data, status) {
  // console.info('jLinkComplete');
 // console.info(data.titleStr);
  // console.info(status);
 $('body').attr('class', '').addClass(data.titleStr);
  $('.body').empty().html(data.contentStr).unblock();
 init();
 }

 set up in dom ready
 $('.tabs a').live('click', function(event, args) {
  jLinkCall(event, args, this);
 event.preventDefault();
 event.stopPropagation();
  return false;
 });

 This is an issue that only is apparent in ie7   8 all works without issue
 in other browsers - not ie 6  though (but who cares)  any ideas?


 - S



[jQuery] How to change the pathClass when a sub-menu is clicked using Superfish

2009-09-15 Thread Xtreme

Hi,
how do u change the pathClass when a sub-menu is clicked..
in the examples given in Superfish.. (http://users.tpg.com.au/j_birch/
plugins/superfish/#sample4)
the pathClass is changed from the server-side
by adding the 'current' class to the list items..
i want to apply the 'current' class to the list items using the
javascript without
calling back to the server...
any help will be really appreciated..
thanks


[jQuery] Superfish Sub menu font size change?

2009-09-15 Thread greencode

I'd like to have the sub menu a different font size to the main menu
but when I change it all appears okay until I have a sub sub menu and
then that column then seems to overlap the sub menu column, rather
than staying perfectly aligned next to it. Is there any way to change
the font size without this happening? Thanks in advance.


[jQuery] append script in ajax cross domain on success function is not working.(script not excuting)

2009-09-15 Thread steven

Hi everyone, i recently tried to get some script off a remote server
through ajax. After days of searching and trying, i finally had it
working apart from appending the script inside the success function of
the ajax call, but the append script works outside of the ajax
function with a little hack(set up a delay)  I have the code shown
below with more explaination.
code
   /*in page header/
  var flashHTML;
  $.ajax({
  url: crossdomainURL,
  data: { 'ClientID': '100', 'CatID': '11',
'LessonID': null, 'ClientUserID': null },
  contentType: application/json; charset=utf-8,
  dataType: jsonp,
  success: function(data, textStatus) {
  //alert(data);
  //alert(data.d);//NOTE: i can get the return
data here.
  //alert(JSON.stringify(data));
  flashHTML = data.d;
  //$(#flash).append(flashHTML);  //Note: if I
uncomment this line here, the html part of the flashHTML
  //
will be shown on the page but the script will not excute.
  },
  error: function(err) {
  alert(errr);
  }
  });

  /*in page body/
  body 
  form id=form1 runat=server

  div id=flash/div

  script language=javascript type=text/javascript
  setTimeout(showFlash(), 500);// Setup a time
delay, because the flashHTML is obtained from an ajax call, it will
NOT
// be
rdy without the delay.
  function showFlash() {
  $(#flash).append(flashHTML);   // If i append the
flashHTML here, the script inside the flashHTML will be excuted.
 // if
i comment this out and put it inside the success function of the ajax
call, it doesn't
 //
work.
  }
  /script
 /form
 /body
/code

does anyone know whats the problem is? any help will be appreciated.
Thanks.
PS: i tried to set the ajax call the async: false, but it doesn't
work. I am not sure whether its a bug or what, but set async to false
doesn't have any effect on how the ajax function behaved.


[jQuery] Re: this.each is not a function

2009-09-15 Thread tg @oh

Just looking at the code I question the following:
attributes no longer use the '@' symbol in jquery 1.3.?

'this' is most likely not a jquery object, so each is not defined for
it.

tg


On Sep 13, 2:24 pm, shapper mdmo...@gmail.com wrote:
 Hello,

 I am using JQuery 1.3.2 and I get the error this.each is not a
 function when I try to use the following plugin:

 jQuery.fn.defuscate = function(settings) {
     settings = jQuery.extend({
         link: true
     }, settings);
     var regex = /\b([A-Z0-9._%-]+)\([^)]+\)((?:[A-Z0-9-]+\.)+[A-Z]
 {2,6})\b/gi;
     return this.each(function() {
         if ($(this).is('a...@href]')) {
             // If it's an a element, defuscate the href attribute
             $(this).attr('href', $(this).attr('href').replace(regex,
 '$...@$2'));
             // Make sure that the element's contents is not made into
 a link
             var is_link = true;
             //alert($(this).attr('href'));
         }
         // Defuscate the element's contents
         $(this).html($(this).html().replace(regex, (settings.link  !
 is_link ? 'a href=mailto:$...@$2;$...@$2/a' : '$...@$2')));
     });

 }

 Could someone, please, tell me what is wrong?

 Thanks,
 Migueç


[jQuery] Simple/short way to bind one event to multiple objects?

2009-09-15 Thread cgp

I have 2 or more objects that onclick(), will call the same function.
Right now I have the following:


$(#obj1).change( function() {
setupPage();
});
$(#obj2).change( function() {
setupPage();
});
$(#obj3).change( function() {
setupPage();
});



I was wondering if there is a way to simplify or clean up the code,
since they are all doing the same thing and responding to the same
event. This is just for refactoring reasons because my code is getting
too long/messy.

Thanks.


[jQuery] AJAX: Display raw XML Document

2009-09-15 Thread Jonathan

I'm re-writing a test page for a RESTful web service with AJAX, and
need to be able to display the XML or JSON response in a textarea or a
div. I'm re-writing the web page to work off jQuery, but I'm stuck
here.

The best response I can get is: [Object XMLDocument]

I have to set a custom Authorization header, set an HTTP method (get,
put, post, or delete), send data, and display the raw XML (or JSON,
depending on the request) response in the page.

With firebug I see the XML response is there, but I can't figure out
how to display that raw XML with jQuery. It worked with the prototype
js, but I'm stumped trying to get it to work with jQuery.

It seems like a simple enough task, the XML is there, I want to print
it out on the page. I've spent hours searching through the jQuery docs
and online examples to no avail.

Any ideas?


[jQuery] Superfish and multilingual support

2009-09-15 Thread Sreckop

Hi,
Does Superfish support multilingual joomla 1.5 extensions like
Joomfish or M17n?

What I need is that based on the language selected on the site display
the menu items on that specific language, and when the language is
switched that displays the menu items in that different language.


[jQuery] Jquery document .ready function throwing object expected

2009-09-15 Thread Vardhini

Hi,

I'm getting Javascript error object expectedon PageLoad at the
following line:

$(document).ready(function()

I found that  alert(typeof $); is returing undefined.

Below is the code snippet:

 script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
javascript language =javascript/script
script src=../../Scripts/jquery-1.3.2.js type=text/javascript
language =javascript/script
script src=../../Scripts/jquery.validate.min.js type=text/
javascript language =javascript/script
script src=../../Scripts/jquery.metadata.js type=text/
javascript language =javascript/script
script src=../../Scripts/ui.datepicker.js type=text/
javascript language =javascript/script
script src=../../Scripts/ui.core.js type=text/javascript
language =javascript/script

script type=text/javascript language =javascript
alert(typeof $);
$(document).ready(function() {
$(#FromDate).datepicker();

});

Can anyone let me know what i'm doing wrong? Thanks.


[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Steven Yang
i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it behind
jquery-1.3.2.js

and also putting ui.core.js before ui.datepicker.js


On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com wrote:


 Hi,

 I'm getting Javascript error object expectedon PageLoad at the
 following line:

 $(document).ready(function()

 I found that  alert(typeof $); is returing undefined.

 Below is the code snippet:

  script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
 javascript language =javascript/script
script src=../../Scripts/jquery-1.3.2.js type=text/javascript
 language =javascript/script
script src=../../Scripts/jquery.validate.min.js type=text/
 javascript language =javascript/script
script src=../../Scripts/jquery.metadata.js type=text/
 javascript language =javascript/script
script src=../../Scripts/ui.datepicker.js type=text/
 javascript language =javascript/script
script src=../../Scripts/ui.core.js type=text/javascript
 language =javascript/script

 script type=text/javascript language =javascript
alert(typeof $);
$(document).ready(function() {
$(#FromDate).datepicker();

});

 Can anyone let me know what i'm doing wrong? Thanks.



[jQuery] Re: Blocking UI for synchronous ajax calls

2009-09-15 Thread Mike Alsup

    I have tested BlockUI Plugin but it does not start when I call it,
 because I can see with Firebub that the ajax calls are finished when
 BlockUI Plugin starts.

And that is exactly the problem with making synchronous calls to the
server - it locks the browser.  I strongly recommend using
asynchronous calls instead - I wish the XHR didn't even have a sync
API because I don't believe it should ever be used.  Asynchronous
programming is only mildly more abstract that synchronous.

Mike


[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Vardhini

Thanks for the response..I tried ..both no luck..

On Sep 15, 3:43 pm, Steven Yang kenshin...@gmail.com wrote:
 i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it behind
 jquery-1.3.2.js

 and also putting ui.core.js before ui.datepicker.js

 On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com wrote:

  Hi,

  I'm getting Javascript error object expectedon PageLoad at the
  following line:

  $(document).ready(function()

  I found that  alert(typeof $); is returing undefined.

  Below is the code snippet:

   script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
  javascript language =javascript/script
     script src=../../Scripts/jquery-1.3.2.js type=text/javascript
  language =javascript/script
     script src=../../Scripts/jquery.validate.min.js type=text/
  javascript language =javascript/script
     script src=../../Scripts/jquery.metadata.js type=text/
  javascript language =javascript/script
     script src=../../Scripts/ui.datepicker.js type=text/
  javascript language =javascript/script
     script src=../../Scripts/ui.core.js type=text/javascript
  language =javascript/script

  script type=text/javascript language =javascript
     alert(typeof $);
     $(document).ready(function() {
         $(#FromDate).datepicker();

     });

  Can anyone let me know what i'm doing wrong? Thanks.


[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Steven Yang
hum...
how about just try loading the jquery-1.3.2.js first and see if you get the
$ as an Object
and if that works then try loading one after another and see which one is
having error.

On Tue, Sep 15, 2009 at 6:54 PM, Vardhini vardhini...@gmail.com wrote:


 Thanks for the response..I tried ..both no luck..

 On Sep 15, 3:43 pm, Steven Yang kenshin...@gmail.com wrote:
  i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it behind
  jquery-1.3.2.js
 
  and also putting ui.core.js before ui.datepicker.js
 
  On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com wrote:
 
   Hi,
 
   I'm getting Javascript error object expectedon PageLoad at the
   following line:
 
   $(document).ready(function()
 
   I found that  alert(typeof $); is returing undefined.
 
   Below is the code snippet:
 
script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/jquery-1.3.2.js type=text/javascript
   language =javascript/script
  script src=../../Scripts/jquery.validate.min.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/jquery.metadata.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/ui.datepicker.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/ui.core.js type=text/javascript
   language =javascript/script
 
   script type=text/javascript language =javascript
  alert(typeof $);
  $(document).ready(function() {
  $(#FromDate).datepicker();
 
  });
 
   Can anyone let me know what i'm doing wrong? Thanks.



[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Raju
can u check the FromDate in the form , is it properly spelled,
Warm Regards,

Mari Raj K,
Bangalore
+91 9740765135


On Tue, Sep 15, 2009 at 4:24 PM, Vardhini vardhini...@gmail.com wrote:


 Thanks for the response..I tried ..both no luck..

 On Sep 15, 3:43 pm, Steven Yang kenshin...@gmail.com wrote:
  i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it behind
  jquery-1.3.2.js
 
  and also putting ui.core.js before ui.datepicker.js
 
  On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com wrote:
 
   Hi,
 
   I'm getting Javascript error object expectedon PageLoad at the
   following line:
 
   $(document).ready(function()
 
   I found that  alert(typeof $); is returing undefined.
 
   Below is the code snippet:
 
script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/jquery-1.3.2.js type=text/javascript
   language =javascript/script
  script src=../../Scripts/jquery.validate.min.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/jquery.metadata.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/ui.datepicker.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/ui.core.js type=text/javascript
   language =javascript/script
 
   script type=text/javascript language =javascript
  alert(typeof $);
  $(document).ready(function() {
  $(#FromDate).datepicker();
 
  });
 
   Can anyone let me know what i'm doing wrong? Thanks.



[jQuery] Re: Ajax

2009-09-15 Thread Matthew Rolph
well, i fixed that at least the source shows right now
can you see any probs. now?

On Mon, Sep 14, 2009 at 9:15 PM, Steven Yang kenshin...@gmail.com wrote:

 hi
 this is all i see in the source of your page

 !DOCTYPE html html head titleAjax - jQuery Tests/title script
 src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js;
 /script style

 i dont think its complete. Might be something wrong on your serverside
 program.

 On Tue, Sep 15, 2009 at 9:02 AM, Matt marine.ro...@gmail.com wrote:


 I made a page that would load 2 html pages, had a footer to show both,
 2 links to show indivually, the divs to load them in, and the sticky
 footer css. My js seems valid, but the page is just completely blank.
 URL: http://testingspot.hostcell.net/sandbox/tests/jquery/ajax/ajax.html





[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Dhruva Sagar
Are you sure that the src paths are all correct ?
Thanks  Regards,
Dhruva Sagar.


Pablo Picassohttp://www.brainyquote.com/quotes/authors/p/pablo_picasso.html
- Computers are useless. They can only give you answers.

On Tue, Sep 15, 2009 at 4:24 PM, Vardhini vardhini...@gmail.com wrote:


 Thanks for the response..I tried ..both no luck..

 On Sep 15, 3:43 pm, Steven Yang kenshin...@gmail.com wrote:
  i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it behind
  jquery-1.3.2.js
 
  and also putting ui.core.js before ui.datepicker.js
 
  On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com wrote:
 
   Hi,
 
   I'm getting Javascript error object expectedon PageLoad at the
   following line:
 
   $(document).ready(function()
 
   I found that  alert(typeof $); is returing undefined.
 
   Below is the code snippet:
 
script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/jquery-1.3.2.js type=text/javascript
   language =javascript/script
  script src=../../Scripts/jquery.validate.min.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/jquery.metadata.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/ui.datepicker.js type=text/
   javascript language =javascript/script
  script src=../../Scripts/ui.core.js type=text/javascript
   language =javascript/script
 
   script type=text/javascript language =javascript
  alert(typeof $);
  $(document).ready(function() {
  $(#FromDate).datepicker();
 
  });
 
   Can anyone let me know what i'm doing wrong? Thanks.


[jQuery] Re: error in ie7 ie8 only

2009-09-15 Thread Sam Sherlock
seems this may be relevant [1] but I can't find where I can parseInt - might
be a plugin that is causing the issue

I am using blockui - I thought that noticing that blockui uses this sz()
which parses the int - maybe I need to make another plugin use sz()

this results from the following
$('.tabs a, a.groove').live('click', function(event, args) {
 jLinkCall(event, args, this);
event.preventDefault();
event.stopPropagation();
 return false;
});

[1]
http://stackoverflow.com/questions/933564/jquery-widthval-error-in-ie-invalid-argument
- S


2009/9/15 Sam Sherlock sam.sherl...@gmail.com

 following up on that when debugging I can continue through the error and it
 works as expected.  but with debugging off the process is interrupted
 - S


 2009/9/15 Sam Sherlock sam.sherl...@gmail.com

 js code:
 function jLinkCall(e, a, o) {
 var jUrl = null, jArgs = null, obTitle = '';
  // console.info('jLinkCall');
 // console.info(e);
  // console.info(a);
 // console.info($(o).attr('href'));

 jUrl = $(o).attr('href') + '';
 jUrl = jUrl.replace(/.html/, '');

 if($(o).attr('title'))
 obTitle = $(o).attr('title');

 // block with growl
 //$('#body').growlUI('Growl Notification', 'Have a nice day!');
  $('.body').block({
 message: 'img src=/img/2-0.gif /',
  css: { border: '1px solid #FFF; background: #FFF;' }})
  $.post('./json.php?p='+jUrl, null, jLinkComplete, json)

 // convert the html url to json url
 // process the json object
  // oncomplete call jLinkComplete

 }

 function jLinkComplete(data, status) {
  // console.info('jLinkComplete');
 // console.info(data.titleStr);
  // console.info(status);
 $('body').attr('class', '').addClass(data.titleStr);
  $('.body').empty().html(data.contentStr).unblock();
 init();
 }

 set up in dom ready
 $('.tabs a').live('click', function(event, args) {
  jLinkCall(event, args, this);
 event.preventDefault();
 event.stopPropagation();
  return false;
 });

 This is an issue that only is apparent in ie7   8 all works without issue
 in other browsers - not ie 6  though (but who cares)  any ideas?


 - S





[jQuery] Closing thickbox in cross domain

2009-09-15 Thread baby

Hi All,

We have a requirement where we are opening a thickbox when user clicks
on the button which is running on particular domain. The i want to
close the thickbox when user clicks on the button which is inside it
(the page is from another domain). I tried to close it using
window.top.tb_remove(); tb_remove(); however i am getting permission
denied error.

Does anybody know how do i resolve this?

Thanks,
Baby


[jQuery] Re: Jquery gradient and tabs

2009-09-15 Thread anush



On Sep 14, 3:58 pm, MiKiTiE mikiji...@googlemail.com wrote:
 Could you provide a link?



http://wildindia.org/mwtest/grad.php

If you see the there, the Tab #2 is inactive.

-
Anush


[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Vardhini

yeah..I tried..i'm getting $ as Undefined. Important point to note
is that it is working fine when we run from VStudio but when
application is hosted on IIS, it is throwing the javascript  error.


On Sep 15, 3:59 pm, Steven Yang kenshin...@gmail.com wrote:
 hum...
 how about just try loading the jquery-1.3.2.js first and see if you get the
 $ as an Object
 and if that works then try loading one after another and see which one is
 having error.

 On Tue, Sep 15, 2009 at 6:54 PM, Vardhini vardhini...@gmail.com wrote:

  Thanks for the response..I tried ..both no luck..

  On Sep 15, 3:43 pm, Steven Yang kenshin...@gmail.com wrote:
   i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it behind
   jquery-1.3.2.js

   and also putting ui.core.js before ui.datepicker.js

   On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com wrote:

Hi,

I'm getting Javascript error object expectedon PageLoad at the
following line:

$(document).ready(function()

I found that  alert(typeof $); is returing undefined.

Below is the code snippet:

 script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
javascript language =javascript/script
   script src=../../Scripts/jquery-1.3.2.js type=text/javascript
language =javascript/script
   script src=../../Scripts/jquery.validate.min.js type=text/
javascript language =javascript/script
   script src=../../Scripts/jquery.metadata.js type=text/
javascript language =javascript/script
   script src=../../Scripts/ui.datepicker.js type=text/
javascript language =javascript/script
   script src=../../Scripts/ui.core.js type=text/javascript
language =javascript/script

script type=text/javascript language =javascript
   alert(typeof $);
   $(document).ready(function() {
       $(#FromDate).datepicker();

   });

Can anyone let me know what i'm doing wrong? Thanks.


[jQuery] Re: Jquery document .ready function throwing object expected

2009-09-15 Thread Raju
remove this and try it ..

script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
javascript language =javascript/script



egards,

Mari Raj K,
Bangalore
+91 9740765135


On Tue, Sep 15, 2009 at 4:45 PM, Vardhini vardhini...@gmail.com wrote:


 yeah..I tried..i'm getting $ as Undefined. Important point to note
 is that it is working fine when we run from VStudio but when
 application is hosted on IIS, it is throwing the javascript  error.


 On Sep 15, 3:59 pm, Steven Yang kenshin...@gmail.com wrote:
  hum...
  how about just try loading the jquery-1.3.2.js first and see if you get
 the
  $ as an Object
  and if that works then try loading one after another and see which one is
  having error.
 
  On Tue, Sep 15, 2009 at 6:54 PM, Vardhini vardhini...@gmail.com wrote:
 
   Thanks for the response..I tried ..both no luck..
 
   On Sep 15, 3:43 pm, Steven Yang kenshin...@gmail.com wrote:
i am not sure what /jquery-1.3.2-vsdoc.jsis for but try putting it
 behind
jquery-1.3.2.js
 
and also putting ui.core.js before ui.datepicker.js
 
On Tue, Sep 15, 2009 at 6:31 PM, Vardhini vardhini...@gmail.com
 wrote:
 
 Hi,
 
 I'm getting Javascript error object expectedon PageLoad at the
 following line:
 
 $(document).ready(function()
 
 I found that  alert(typeof $); is returing undefined.
 
 Below is the code snippet:
 
  script src=../../Scripts/jquery-1.3.2-vsdoc.js type=text/
 javascript language =javascript/script
script src=../../Scripts/jquery-1.3.2.js
 type=text/javascript
 language =javascript/script
script src=../../Scripts/jquery.validate.min.js type=text/
 javascript language =javascript/script
script src=../../Scripts/jquery.metadata.js type=text/
 javascript language =javascript/script
script src=../../Scripts/ui.datepicker.js type=text/
 javascript language =javascript/script
script src=../../Scripts/ui.core.js type=text/javascript
 language =javascript/script
 
 script type=text/javascript language =javascript
alert(typeof $);
$(document).ready(function() {
$(#FromDate).datepicker();
 
});
 
 Can anyone let me know what i'm doing wrong? Thanks.



[jQuery] IE 8 chokes on HTML5 elements inserted with jQuery

2009-09-15 Thread Perceptes

Hi all,

I've encountered a problem with the combination of jQuery, IE, and
HTML5 elements. HTML5 elements inserted into the page after initial
load via jQuery's DOM manipulation functions are not parsed correctly
by IE, even with Remy Sharp's HTML5 shiv script.

With the help of jgraham from the WHATWG IRC channel, I have set up a
page that shows this problem in two cases:

1) A simplified version of the contact form from my new site where I
first encountered this problem.
2) A tiny test script that shows the failure in a stripped down form.

The two test cases and full details are here: http://www.jimmycuadra.com/ie8/

Thanks in advance for any insight anyone can provide in how to deal
with this.


[jQuery] Re: Very disappointed with jquery and iframe communication

2009-09-15 Thread Leonardo K
Are you sure that $(frames['Theiframe']) is returning the iframe ?

On Tue, Sep 15, 2009 at 05:53, ximo wallas igguan...@yahoo.com wrote:

 After 1 day googling and trying I find no agreement in a solid method for
 comunicating with iframe, this is the nearest point I've been to get in
 touch with IFRAME:

 $(frames['Theiframe']).ready( function ()
 {
 alert('Frame is loaded');

 });

 This will alert the message, but any attempt to comunicate with the iframe
 and access it's contents have been useless, I have a hidden field with with
 ID login and I'm trying to get it's value:

 $(frames['Theiframe']).find(#login).val(); //Doesn't work in FF 3.0.14


 /

 var $currentIFrame = $(frames['Theiframe']);
 $currentIFrame.contents().find(body #login).val() //Neither does in FF
 3.0.14

 If you Google a few you will see that everyone is giving it's own opinion
 on how to do it, but there's no agreement and no crossbrowser solid
 solution...





[jQuery] Re: Jquery gradient and tabs

2009-09-15 Thread MiKiTiE

Having checked the source code, it looks like you're not even
including the core and tabs ui.

For example:

script type=text/javascript src=http://jqueryui.com/latest/ui/
ui.core.js/script
script type=text/javascript src=http://jqueryui.com/latest/ui/
ui.tabs.js/script

If you were to link direct to jquery. That may be why your tabs are
not working properly.

On Sep 15, 12:15 pm, anush anushshe...@gmail.com wrote:
 On Sep 14, 3:58 pm, MiKiTiE mikiji...@googlemail.com wrote:

  Could you provide a link?

 http://wildindia.org/mwtest/grad.php

 If you see the there, the Tab #2 is inactive.

 -
 Anush


[jQuery] Re: IE 8 chokes on HTML5 elements inserted with jQuery

2009-09-15 Thread Nick Fitzsimons

2009/9/15 Perceptes jimmycua...@gmail.com:

 I've encountered a problem with the combination of jQuery, IE, and
 HTML5 elements. HTML5 elements inserted into the page after initial
 load via jQuery's DOM manipulation functions are not parsed correctly
 by IE, even with Remy Sharp's HTML5 shiv script.


The problem is that jQuery uses innerHTML, rather than DOM methods, to
insert the new content (which is why it's passed to jQuery as a
string). This means it relies on IE's HTML parser to correctly parse
the markup from the string when it is inserted.

When IE's parser encounters an element it doesn't recognise the name
of, it creates the element as an empty element (similar to br or
img), then parses the content as if it were sibling nodes, then
creates an empty element whose name begins with a slash (/ARTICLE for
example); you can see this on your test page by clicking on the IE
fail button and then entering:
javascript:alert(document.body.childNodes[0].childNodes[1].firstChild.tagName)
and
javascript:alert(document.body.childNodes[0].childNodes[1].lastChild.tagName)
in the location bar; the first will show ARTICLE, and the second
will show /ARTICLE.

To work around this you basically have two options:

1. Before any other script is executed, add the line:
document.createElement(article);
and add equivalent lines for any other HTML5-specific elements you
wish to use (such as section). This prompts IE's HTML parser to expect
blocks with that tagName and it will then parse them correctly.

2. Don't use jQuery's innerHTML-dependent approach to creating new
content; instead, use DOM creation methods directly, for example:

var article = document.createElement(article);
var header = article.appendChild(document.createElement(header));
header.appendChild(document.createTextNode(Hello World);

var container = document.getElementsByTagName(div)[0];
container.insertBefore(article, container .getElementsByTagName(h2)[1]);

... and so on. (Actually, you can use jQuery for selecting the correct
insertion point and for inserting the new elements there, as jQuery
can cope with elements when inserting content.)

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/


[jQuery] Re: Get the onclick method of an element

2009-09-15 Thread MiKiTiE

Perhaps then you can extract it as text like I mentioned in my first
post, then store it in a variable?

As I am not sure what your function does or why it needs to be applied
this way, I can't solve the problem exactly - but why not just use an
event instead of an onclick in the element? That is what jQuery is
there for :-)

On Sep 15, 9:50 am, sirrocco xavier...@gmail.com wrote:
 Well .. that's the problem - i tried it like that and it didn't work.

 When setting the attribute back on the link, the this in DoSomething
 (this); is not the link, but the window.

 On Sep 15, 11:41 am,MiKiTiEmikiji...@googlemail.com wrote:

  Sorry I should have written

  $('a').attr('onclick',onclick);

  (setting the attribute value not the inner text!)

  On Sep 15, 9:09 am, sirrocco xavier...@gmail.com wrote:

   Let's say you have a :

   a href=# onclick='DoSomething(this);'asd/a

   I want to get the onclick text in a variable - something like

   var onclick = $('a').attr('onclick');

   The problem is that the onclick variable now is a function and if I
   try to execute , this   wil be the document instead of the link .

   How can I get only the text, so I can later reattach it to the link ?


[jQuery] Re: Easy show()/hide() Question

2009-09-15 Thread Leonardo K
The problem is this line: $(this).children('ul').hide('fast');

If you changed to .hide() without the speed, works fine. I dont know if this
is a jquery bug.

On Mon, Sep 14, 2009 at 09:31, GLSmyth george.sm...@gmail.com wrote:


 I am missing something fundamental and am sure that someone can point
 me in the right direction.

 I have a list like so:

li id=GalleryMenua href=../Gallery/Default.htmDD/a
  ul class=DoNotDisplay
lia href=../Gallery/Santuary.htmSantuary/a/li
lia href=../Gallery/Stream.htmStream/a/li
lia href=../Gallery/Winter.htmWinter/a/li
  /ul
/li

 I have styled it so that the list items float.  The class DoNotDisplay
 hides the unordered list.  When the mouse hovers over GalleryMenu then
 jQuery removes the DoNotDisplay class so that the unordered list is
 displayed, moving off GalleryMenu hides the list.  This works fine and
 the code is:

 $(document).ready(
  function() {
$('li#GalleryMenu').add('li#PoemMenu').hover(
  function() {
$(this).children('ul').removeClass('DoNotDisplay');
  },
  function() {
$(this).children('ul').addClass('DoNotDisplay');
  }
);
  }
 );

 I would like the unordered list to slide open, so I changed the code
 to:

 $(document).ready(
  function() {
$('li#GalleryMenu').add('li#PoemMenu').hover(
  function() {
$(this).children('ul').show('fast');
console.log('Open list');
  },
  function() {
$(this).children('ul').hide('fast');
console.log('Close list');
  }
);
  }
 );

 The list opens properly, but does not close when I move the mouse from
 the list.  When looking at this in Firebug I see that 'hide' is
 firing, but for some reason does not close the list.  If I unfloat
 the list then the code works just fine.

 What am I missing?  I'm sure that it is staring me in the face, but I
 am just not seeing it.  The full code can be found at
 http://glsmyth.com/Sedwick/Templates/

 Thanks for looking.

 Cheers -

 george


[jQuery] Re: Jquery gradient and tabs

2009-09-15 Thread Anush Shetty

On Tue, Sep 15, 2009 at 5:55 PM, MiKiTiE mikiji...@googlemail.com wrote:

 Having checked the source code, it looks like you're not even
 including the core and tabs ui.

 For example:

 script type=text/javascript src=http://jqueryui.com/latest/ui/
 ui.core.js/script
 script type=text/javascript src=http://jqueryui.com/latest/ui/
 ui.tabs.js/script

 If you were to link direct to jquery. That may be why your tabs are
 not working properly.


No, its not that. I am using this technique

http://blueprintcss.org/demos/tabs.html

This doesn't need ui.core.js and ui.tabs.js

-
Anush


[jQuery] Re: Simple/short way to bind one event to multiple objects?

2009-09-15 Thread Mr Speaker

you can select multiple objects in the selector, like: $
(#obj1,#obj2,#obj3).change(...)


On Sep 15, 7:42 am, cgp cgpala...@gmail.com wrote:
 I have 2 or more objects that onclick(), will call the same function.
 Right now I have the following:

 
 $(#obj1).change( function() {
         setupPage();});

 $(#obj2).change( function() {
         setupPage();});

 $(#obj3).change( function() {
         setupPage();});

 

 I was wondering if there is a way to simplify or clean up the code,
 since they are all doing the same thing and responding to the same
 event. This is just for refactoring reasons because my code is getting
 too long/messy.

 Thanks.


[jQuery] Re: Problem with .live() events in a widget in FF3

2009-09-15 Thread Mr Speaker

Is it just because alert() is not allowed in FF? (needs to be alert(1)
or some-such). The code looks fine to me otherwise.

On Sep 15, 5:38 am, ChrisP idevt...@gmail.com wrote:
 I am creating a simple jQuery widget and have the following two lines
 in the _init() method.

     this.element.find(li.thumb img).css(cursor, pointer);
     this.element.find(li.thumb img).live(click, function() { alert
 (); });

 The addition of the style property in the first line works in both IE7
 and FF3. However, the binding of the event in the second line only
 works in IE7, not in FF3.

 Elements are dynamically added to the widget so I need to use the .live
 () method.

 Any thoughts on why this may be occurring?

 Thanks


[jQuery] Re: Very disappointed with jquery and iframe communication

2009-09-15 Thread Paolo Chiodi

Of course it doesn't work.
You are searching for node elements with id=login that are child of
your iframes. You need to use the dom of the page loaded inside the i
frame
try $(frames['Theiframe']).get(0).contentDocument

I in the content page is present jquery, use
$(frames['Theiframe']).get(0).contentWindow.$('#login')

BTW, you can access child dom only if in same domain

Paolo

On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas igguan...@yahoo.com wrote:

 After 1 day googling and trying I find no agreement in a solid method for 
 comunicating with iframe, this is the nearest point I've been to get in touch 
 with IFRAME:

 $(frames['Theiframe']).ready( function ()
 {
     alert('Frame is loaded');

 });

 This will alert the message, but any attempt to comunicate with the iframe 
 and access it's contents have been useless, I have a hidden field with with 
 ID login and I'm trying to get it's value:

 $(frames['Theiframe']).find(#login).val(); //Doesn't work in FF 3.0.14

 /

 var $currentIFrame = $(frames['Theiframe']);
 $currentIFrame.contents().find(body #login).val() //Neither does in FF 
 3.0.14

 If you Google a few you will see that everyone is giving it's own opinion on 
 how to do it, but there's no agreement and no crossbrowser solid solution...




[jQuery] Re: trim string

2009-09-15 Thread teknoFX

You could easily just do the following:

cat=[com12, com1, cop233, com1.1, sap-12-1];
cat = $.map(cat, function(a){ return a.replace(/[\d\.\-]/g, ); });

Good Luck!


[jQuery] Re: Jquery gradient and tabs

2009-09-15 Thread MiKiTiE

Ah, since I am not familiar with this implementation of tabs (only the
jQuery built in one) I'm not sure I know the answer, sorry. Have you
contacted the creator of those tabs?

On Sep 15, 1:38 pm, Anush Shetty anushshe...@gmail.com wrote:
 On Tue, Sep 15, 2009 at 5:55 PM,MiKiTiEmikiji...@googlemail.com wrote:

  Having checked the source code, it looks like you're not even
  including the core and tabs ui.

  For example:

  script type=text/javascript src=http://jqueryui.com/latest/ui/
  ui.core.js/script
  script type=text/javascript src=http://jqueryui.com/latest/ui/
  ui.tabs.js/script

  If you were to link direct to jquery. That may be why your tabs are
  not working properly.

 No, its not that. I am using this technique

 http://blueprintcss.org/demos/tabs.html

 This doesn't need ui.core.js and ui.tabs.js

 -
 Anush


[jQuery] Re: Get the onclick method of an element

2009-09-15 Thread sirrocco

Perhaps then you can extract it as text like I mentioned in my first
post, then store it in a variable?

How do I extract it like text ? Calling the .text() method, as
expected doesn't return what I need - DoSomething(this);

On Sep 15, 3:30 pm, MiKiTiE mikiji...@googlemail.com wrote:
 Perhaps then you can extract it as text like I mentioned in my first
 post, then store it in a variable?

 As I am not sure what your function does or why it needs to be applied
 this way, I can't solve the problem exactly - but why not just use an
 event instead of an onclick in the element? That is what jQuery is
 there for :-)

 On Sep 15, 9:50 am, sirrocco xavier...@gmail.com wrote:

  Well .. that's the problem - i tried it like that and it didn't work.

  When setting the attribute back on the link, the this in DoSomething
  (this); is not the link, but the window.

  On Sep 15, 11:41 am,MiKiTiEmikiji...@googlemail.com wrote:

   Sorry I should have written

   $('a').attr('onclick',onclick);

   (setting the attribute value not the inner text!)

   On Sep 15, 9:09 am, sirrocco xavier...@gmail.com wrote:

Let's say you have a :

a href=# onclick='DoSomething(this);'asd/a

I want to get the onclick text in a variable - something like

var onclick = $('a').attr('onclick');

The problem is that the onclick variable now is a function and if I
try to execute , this   wil be the document instead of the link .

How can I get only the text, so I can later reattach it to the link ?




[jQuery] Re: content containing JS retrieved via AJAX crashes browser

2009-09-15 Thread mstone42

After doing a bit more research, I've tried using live() and load(),
both with no further advancement.

Can anyone help shed some light on this problem?  Please?!?

--Mitch


[jQuery] Re: saving values from a multi select list.

2009-09-15 Thread shaded

Still stuck on this.no one has even a suggestion as to what maybe
wrong?


[jQuery] Re: Simple/short way to bind one event to multiple objects?

2009-09-15 Thread KeeganWatkins

The change event handler can also be passed by reference, avoiding the
need for the closures

(#obj1,#obj2,#obj3).change( setupPage );


On Sep 15, 7:40 am, Mr Speaker mrspea...@gmail.com wrote:
 you can select multiple objects in the selector, like: $
 (#obj1,#obj2,#obj3).change(...)

 On Sep 15, 7:42 am, cgp cgpala...@gmail.com wrote:

  I have 2 or more objects that onclick(), will call the same function.
  Right now I have the following:

  
  $(#obj1).change( function() {
          setupPage();});

  $(#obj2).change( function() {
          setupPage();});

  $(#obj3).change( function() {
          setupPage();});

  

  I was wondering if there is a way to simplify or clean up the code,
  since they are all doing the same thing and responding to the same
  event. This is just for refactoring reasons because my code is getting
  too long/messy.

  Thanks.


[jQuery] Re: Easy show()/hide() Question

2009-09-15 Thread Steven Black

The problem is synchronicity.  When you add an animation (like slow
or fast) the animation process starts but, behind the scenes,
subsequent lines of javascript continue to execute during the
animation.

When you need things in strict order, and you have an animation, use
the callback, which will fire once the animation is complete.

In other words, use show(speed, callback) and hide(speed, callback).

**--**  Steve





On Sep 10, 10:18 am, GLSmyth george.sm...@gmail.com wrote:
 I am missing something fundamental and am sure that someone can point
 me in the right direction.

 I have a list like so:

     li id=GalleryMenua href=../Gallery/Default.htmDD/a
       ul class=DoNotDisplay
         lia href=../Gallery/Santuary.htmSantuary/a/li
         lia href=../Gallery/Stream.htmStream/a/li
         lia href=../Gallery/Winter.htmWinter/a/li
       /ul
     /li

 I have styled it so that the list items float.  The class DoNotDisplay
 hides the unordered list.  When the mouse hovers over GalleryMenu then
 jQuery removes the DoNotDisplay class so that the unordered list is
 displayed, moving off GalleryMenu hides the list.  This works fine and
 the code is:

 $(document).ready(
   function() {
     $('li#GalleryMenu').add('li#PoemMenu').hover(
       function() {
         $(this).children('ul').removeClass('DoNotDisplay');
       },
       function() {
         $(this).children('ul').addClass('DoNotDisplay');
       }
     );
   }
 );

 I would like the unordered list to slide open, so I changed the code
 to:

 $(document).ready(
   function() {
     $('li#GalleryMenu').add('li#PoemMenu').hover(
       function() {
         $(this).children('ul').show('fast');
         console.log('Open list');
       },
       function() {
         $(this).children('ul').hide('fast');
         console.log('Close list');
       }
     );
   }
 );

 The list opens properly, but does not close when I move the mouse from
 the list.  When looking at this in Firebug I see that 'hide' is
 firing, but for some reason does not close the list.  If I unfloat
 the list then the code works just fine.

 What am I missing?  I'm sure that it is staring me in the face, but I
 am just not seeing it.  The full code can be found 
 athttp://glsmyth.com/Sedwick/Templates/

 Thanks for looking.

 Cheers -

 george


[jQuery] Re: Very disappointed with jquery and iframe communication

2009-09-15 Thread ximo wallas
It is firing the alert, you think it is not?
How can I access it and have some control over?




  

[jQuery] Re: saving values from a multi select list.

2009-09-15 Thread Rick Faircloth

I don't have the original message in my email any longer.
Can you post the code involved?

Rick

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of shaded
Sent: Tuesday, September 15, 2009 9:42 AM
To: jQuery (English)
Subject: [jQuery] Re: saving values from a multi select list.


Still stuck on this.no one has even a suggestion as to what maybe
wrong?




[jQuery] Re: saving values from a multi select list.

2009-09-15 Thread shaded

With Pleasure.

===
first post

Im using a plugin called selectchain by Remy Sharp and modified it a
bit. Right now
im trying to pass only selected values of a multi select list through
ajax. The following function does a bit more but im concerned with the
part that says

cust_val: customer.val().join(,)

This should return only selected values. This is what happens if i put
it in an alert().   however when i check firebug to see what was
posted it shows the entire list. I've tried alternatives like
option:selected they all work for alet() .. but the info passed
through ajax shows the entire list.

please help.

customer.selectChain({
   target: market,
   url: callback_url,
   type: POST,
   data: { ajax: true, multsel: market_selects, cust_val: customer.val
().join(,)  }
}).trigger('change');

=
Second Post
=
Ok so i thought that maybe the problem had something to do with the
ajax request so i tried adding the ajaxStart function. See below.

 $(#ddl_customer).change(function(){
  $(#ddl_customer).ajaxStart(function() {
 cuslist = $(this).val().join(, );
  });
  alert(cuslist);

});

$(#ddl_customer).selectChain({
target: market,
url: callback_url,
type: POST,
data: { ajax: true, multsel: market_selects, cust_val:
cuslist  }
 }).trigger('change');

So im trying to get all the selected values from ddl_customer in the
first block of code. then pass it to cust_val in the second block of
code.

note that the alert(custlist) outputs what i expect. but when i check
cust_val in firebug it outputs the entire list, not only selected
values.

Please Help!:(


[jQuery] Show/Hide

2009-09-15 Thread Richard Walsh

I am working on a toolset that shows/hides divs. The divs are named
id-1 to id-6.

div id=id-1
content
/div
div id=id-2
content
/div

And so on. The script I have written is below:

script type=text/javascript
$(function(){
$('#id-2').hide();
$('#id-3').hide();
$('#id-4').hide();
$('#id-5').hide();
$('#id-6').hide();
$('#add_link').click(function(){
$(this).parent().next('div').show('slow');
});
$('#remove_link').click(function(){
$(this).parent().hide('slow');
});
});
/script

The beginning part basically just hides div 2-6 on load. The next part
with #add_link that adds the next div if needed, and then the last,
removes the current div. This all works, but only on first set.

So basically I have a repeated piece; as below:

div id=id-1
label for=reprint_F1Identifer 1/label
select name=reprint_F1 id=reprint_F1
option- Please Select -/option
option value=1Sec/option
option value=2Row/option
option value=3Seat/option
option value=4Ticket Barcode/option
option value=5RecID/option
option value=6Book No./option
option value=7Account No./option
option value=8Other/option
/select
input type=text name=reprint_F1b id=reprint_F1b
a href=# id=add_link class=test ui-state-default ui-corner-
allspan class=ui-icon ui-icon-plus/spanAdd/a
/div

This occurs 6 times, starting on div id=id-2 I add another link
for removing that div.

As I said above, they first set works, but after that it doesn't. How
can I get this working so that it works for all 6. I want to try and
avoid writing a function for all six, as in the future I may have to
add in more items.



[jQuery] Re: Get the onclick method of an element

2009-09-15 Thread MiKiTiE

Ok, I've done some tests and here is my suggestion.

First of all, should just ask - I assume you are calling it after the
element? Probably is obvious, but thought I'd check.

Ok, here's the deal: onclick is not really an attribute but a mouse
event. Therefore jQuery will take the contents as a function and write
it out as an event. The only alternative is to insert your DoSomething
(this); into a standard attribute like title or alt and then take
it from there. This way you should be able to insert it exactly as its
written and not have it converted into an event.

Hope this will help?

On Sep 15, 2:31 pm, sirrocco xavier...@gmail.com wrote:
 Perhaps then you can extract it as text like I mentioned in my first

 post, then store it in a variable?

 How do I extract it like text ? Calling the .text() method, as
 expected doesn't return what I need - DoSomething(this);

 On Sep 15, 3:30 pm,MiKiTiEmikiji...@googlemail.com wrote:

  Perhaps then you can extract it as text like I mentioned in my first
  post, then store it in a variable?

  As I am not sure what your function does or why it needs to be applied
  this way, I can't solve the problem exactly - but why not just use an
  event instead of an onclick in the element? That is what jQuery is
  there for :-)

  On Sep 15, 9:50 am, sirrocco xavier...@gmail.com wrote:

   Well .. that's the problem - i tried it like that and it didn't work.

   When setting the attribute back on the link, the this in DoSomething
   (this); is not the link, but the window.

   On Sep 15, 11:41 am,MiKiTiEmikiji...@googlemail.com wrote:

Sorry I should have written

$('a').attr('onclick',onclick);

(setting the attribute value not the inner text!)

On Sep 15, 9:09 am, sirrocco xavier...@gmail.com wrote:

 Let's say you have a :

 a href=# onclick='DoSomething(this);'asd/a

 I want to get the onclick text in a variable - something like

 var onclick = $('a').attr('onclick');

 The problem is that the onclick variable now is a function and if I
 try to execute , this   wil be the document instead of the link .

 How can I get only the text, so I can later reattach it to the link ?


[jQuery] Re: Easy show()/hide() Question

2009-09-15 Thread Eclectic Mix

Thanks for the note, I'll give that a try.

Cheers -

george


On Sep 15, 10:19 am, Steven Black ste...@stevenblack.com wrote:
 The problem is synchronicity.  When you add an animation (like slow
 or fast) the animation process starts but, behind the scenes,
 subsequent lines of javascript continue to execute during the
 animation.

 When you need things in strict order, and you have an animation, use
 the callback, which will fire once the animation is complete.

 In other words, use show(speed, callback) and hide(speed, callback).

 **--**  Steve

 On Sep 10, 10:18 am, GLSmyth george.sm...@gmail.com wrote:

  I am missing something fundamental and am sure that someone can point
  me in the right direction.

  I have a list like so:

      li id=GalleryMenua href=../Gallery/Default.htmDD/a
        ul class=DoNotDisplay
          lia href=../Gallery/Santuary.htmSantuary/a/li
          lia href=../Gallery/Stream.htmStream/a/li
          lia href=../Gallery/Winter.htmWinter/a/li
        /ul
      /li

  I have styled it so that the list items float.  The class DoNotDisplay
  hides the unordered list.  When the mouse hovers over GalleryMenu then
  jQuery removes the DoNotDisplay class so that the unordered list is
  displayed, moving off GalleryMenu hides the list.  This works fine and
  the code is:

  $(document).ready(
    function() {
      $('li#GalleryMenu').add('li#PoemMenu').hover(
        function() {
          $(this).children('ul').removeClass('DoNotDisplay');
        },
        function() {
          $(this).children('ul').addClass('DoNotDisplay');
        }
      );
    }
  );

  I would like the unordered list to slide open, so I changed the code
  to:

  $(document).ready(
    function() {
      $('li#GalleryMenu').add('li#PoemMenu').hover(
        function() {
          $(this).children('ul').show('fast');
          console.log('Open list');
        },
        function() {
          $(this).children('ul').hide('fast');
          console.log('Close list');
        }
      );
    }
  );

  The list opens properly, but does not close when I move the mouse from
  the list.  When looking at this in Firebug I see that 'hide' is
  firing, but for some reason does not close the list.  If I unfloat
  the list then the code works just fine.

  What am I missing?  I'm sure that it is staring me in the face, but I
  am just not seeing it.  The full code can be found 
  athttp://glsmyth.com/Sedwick/Templates/

  Thanks for looking.

  Cheers -

  george


[jQuery] Re: Very disappointed with jquery and iframe communication

2009-09-15 Thread ximo wallas
How can I tell to the iframe to load() a different content from the main 
document?

--- On Tue, 9/15/09, Paolo Chiodi chiod...@gmail.com wrote:

From: Paolo Chiodi chiod...@gmail.com
Subject: [jQuery] Re: Very disappointed with jquery and iframe communication
To: jquery-en@googlegroups.com
Date: Tuesday, September 15, 2009, 1:42 PM


Of course it doesn't work.
You are searching for node elements with id=login that are child of
your iframes. You need to use the dom of the page loaded inside the i
frame
try $(frames['Theiframe']).get(0).contentDocument

I in the content page is present jquery, use
$(frames['Theiframe']).get(0).contentWindow.$('#login')

BTW, you can access child dom only if in same domain

Paolo

On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas igguan...@yahoo.com wrote:

 After 1 day googling and trying I find no agreement in a solid method for 
 comunicating with iframe, this is the nearest point I've been to get in touch 
 with IFRAME:

 $(frames['Theiframe']).ready( function ()
 {
     alert('Frame is loaded');

 });

 This will alert the message, but any attempt to comunicate with the iframe 
 and access it's contents have been useless, I have a hidden field with with 
 ID login and I'm trying to get it's value:

 $(frames['Theiframe']).find(#login).val(); //Doesn't work in FF 3.0.14

 /

 var $currentIFrame = $(frames['Theiframe']);
 $currentIFrame.contents().find(body #login).val() //Neither does in FF 
 3.0.14

 If you Google a few you will see that everyone is giving it's own opinion on 
 how to do it, but there's no agreement and no crossbrowser solid solution...





  

[jQuery] Re: Selectbox

2009-09-15 Thread Richard Walsh

Actually found what I was looking for, it is here.
http://blog.kotowicz.net/2009/03/jquery-optiontree-demo.html
 Thanks

On Sep 15, 8:50 am, Richard Walsh rwa...@datagroup.ca wrote:
 I remember seeing a sample somewhere, now for the life of me when I
 actually need to use it. I can't remember how or where I found it. I
 am hoping someone can shed some light.

 What I want to achieve, is when a value is picked in a select box, an
 empty input field appears after a value is selected. If someone can
 point me in the right direction it would be great!

 Thanks


[jQuery] how to expand a node dynamicly in treeview plugin

2009-09-15 Thread Sefer KILIÇ

For example I have a treeview control and there are 500 items .
I have also a search box control. When I type one of item of treeview
on searchbox,  I want to find typed item ,  focus it  and expand it
dynamicly.

Is it possible? if is it, how can i do..

Thanks



[jQuery] Selectbox

2009-09-15 Thread Richard Walsh

I remember seeing a sample somewhere, now for the life of me when I
actually need to use it. I can't remember how or where I found it. I
am hoping someone can shed some light.

What I want to achieve, is when a value is picked in a select box, an
empty input field appears after a value is selected. If someone can
point me in the right direction it would be great!

Thanks


[jQuery] Re: Show/Hide

2009-09-15 Thread Richard Walsh

I have figured this out, I replaced

$('#add_link').click(function(){
$(this).parent().next('div').show('slow');
});
$('#remove_link').click(function(){
$(this).parent().hide('slow');
});

with

$('a[id=add_link]').click(function(){
$(this).parent().next('div').show('slow');
});
$('a[id=remove_link]').click(function(){
$(this).parent().hide('slow');
});

On Sep 15, 8:44 am, Richard Walsh rwa...@datagroup.ca wrote:
 I am working on a toolset that shows/hides divs. The divs are named
 id-1 to id-6.

 div id=id-1
 content
 /div
 div id=id-2
 content
 /div

 And so on. The script I have written is below:

 script type=text/javascript
         $(function(){
                 $('#id-2').hide();
                 $('#id-3').hide();
                 $('#id-4').hide();
                 $('#id-5').hide();
                 $('#id-6').hide();
                 $('#add_link').click(function(){
                         $(this).parent().next('div').show('slow');
                 });
                 $('#remove_link').click(function(){
                         $(this).parent().hide('slow');
                 });
         });
 /script

 The beginning part basically just hides div 2-6 on load. The next part
 with #add_link that adds the next div if needed, and then the last,
 removes the current div. This all works, but only on first set.

 So basically I have a repeated piece; as below:

 div id=id-1
         label for=reprint_F1Identifer 1/label
         select name=reprint_F1 id=reprint_F1
                 option- Please Select -/option
                 option value=1Sec/option
                 option value=2Row/option
                 option value=3Seat/option
                 option value=4Ticket Barcode/option
                 option value=5RecID/option
                 option value=6Book No./option
                 option value=7Account No./option
                 option value=8Other/option
         /select
         input type=text name=reprint_F1b id=reprint_F1b
         a href=# id=add_link class=test ui-state-default ui-corner-
 allspan class=ui-icon ui-icon-plus/spanAdd/a
 /div

 This occurs 6 times, starting on div id=id-2 I add another link
 for removing that div.

 As I said above, they first set works, but after that it doesn't. How
 can I get this working so that it works for all 6. I want to try and
 avoid writing a function for all six, as in the future I may have to
 add in more items.


[jQuery] Re: error in ie7 ie8 only

2009-09-15 Thread Sam Sherlock
narrowed down but not solved


this causes error in ie
$('.body').block({
 message: 'img src=/img/2-0.gif /',
css: { border: '1px solid #FFF; background: #FFF;' }})

yet this works
$('.body').block({
message: 'h1Processing/h1',
 css: { border: '3px solid #a00' }
});


so bit of further investigation and I now understand it

css: { border: '1px solid #FFF; background: #FFF;' }

needed to be (no semi colons and make the css setting a JSON object - ff et
al are more forgiving)
css: { border: '1px solid #FFF', background: '#FFF' }



- S


2009/9/15 Sam Sherlock sam.sherl...@gmail.com

 seems this may be relevant [1] but I can't find where I can parseInt -
 might be a plugin that is causing the issue

 I am using blockui - I thought that noticing that blockui uses this sz()
 which parses the int - maybe I need to make another plugin use sz()

 this results from the following
 $('.tabs a, a.groove').live('click', function(event, args) {
  jLinkCall(event, args, this);
 event.preventDefault();
 event.stopPropagation();
  return false;
 });

 [1]
 http://stackoverflow.com/questions/933564/jquery-widthval-error-in-ie-invalid-argument

 - S


 2009/9/15 Sam Sherlock sam.sherl...@gmail.com

 following up on that when debugging I can continue through the error and
 it works as expected.  but with debugging off the process is interrupted
 - S


 2009/9/15 Sam Sherlock sam.sherl...@gmail.com

 js code:
 function jLinkCall(e, a, o) {
 var jUrl = null, jArgs = null, obTitle = '';
  // console.info('jLinkCall');
 // console.info(e);
  // console.info(a);
 // console.info($(o).attr('href'));

 jUrl = $(o).attr('href') + '';
 jUrl = jUrl.replace(/.html/, '');

 if($(o).attr('title'))
 obTitle = $(o).attr('title');

 // block with growl
 //$('#body').growlUI('Growl Notification', 'Have a nice day!');
  $('.body').block({
 message: 'img src=/img/2-0.gif /',
  css: { border: '1px solid #FFF; background: #FFF;' }})
  $.post('./json.php?p='+jUrl, null, jLinkComplete, json)

 // convert the html url to json url
 // process the json object
  // oncomplete call jLinkComplete

 }

 function jLinkComplete(data, status) {
  // console.info('jLinkComplete');
 // console.info(data.titleStr);
  // console.info(status);
 $('body').attr('class', '').addClass(data.titleStr);
  $('.body').empty().html(data.contentStr).unblock();
 init();
 }

 set up in dom ready
 $('.tabs a').live('click', function(event, args) {
  jLinkCall(event, args, this);
 event.preventDefault();
 event.stopPropagation();
  return false;
 });

 This is an issue that only is apparent in ie7   8 all works without
 issue in other browsers - not ie 6  though (but who cares)  any ideas?


 - S






[jQuery] Re: Very disappointed with jquery and iframe communication

2009-09-15 Thread Paolo Chiodi

this should work:
 $(frames['Theiframe']).attr('src', new_page_url);

On Tue, Sep 15, 2009 at 4:45 PM, ximo wallas igguan...@yahoo.com wrote:

 How can I tell to the iframe to load() a different content from the main 
 document?

 --- On Tue, 9/15/09, Paolo Chiodi chiod...@gmail.com wrote:

 From: Paolo Chiodi chiod...@gmail.com
 Subject: [jQuery] Re: Very disappointed with jquery and iframe communication
 To: jquery-en@googlegroups.com
 Date: Tuesday, September 15, 2009, 1:42 PM


 Of course it doesn't work.
 You are searching for node elements with id=login that are child of
 your iframes. You need to use the dom of the page loaded inside the i
 frame
 try $(frames['Theiframe']).get(0).contentDocument

 I in the content page is present jquery, use
 $(frames['Theiframe']).get(0).contentWindow.$('#login')

 BTW, you can access child dom only if in same domain

 Paolo

 On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas igguan...@yahoo.com wrote:
 
  After 1 day googling and trying I find no agreement in a solid method for 
  comunicating with iframe, this is the nearest point I've been to get in 
  touch with IFRAME:
 
  $(frames['Theiframe']).ready( function ()
  {
      alert('Frame is loaded');
 
  });
 
  This will alert the message, but any attempt to comunicate with the iframe 
  and access it's contents have been useless, I have a hidden field with with 
  ID login and I'm trying to get it's value:
 
  $(frames['Theiframe']).find(#login).val(); //Doesn't work in FF 3.0.14
 
  /
 
  var $currentIFrame = $(frames['Theiframe']);
  $currentIFrame.contents().find(body #login).val() //Neither does in FF 
  3.0.14
 
  If you Google a few you will see that everyone is giving it's own opinion 
  on how to do it, but there's no agreement and no crossbrowser solid 
  solution...
 
 



[jQuery] [RELEASE] Karma 0.1 , jquery plugin and examples for manipulating html5 audio, image, canvas elements

2009-09-15 Thread Bryan Berry

We are proud to release Karma version 0.1 today. Please download the
code and try it out for yourself. You can also test out the demo here.
You need Firefox 3.5 to run the demo.

The core of Karma is a jQuery plugin for manipulating html5  audio, image, 
canvas elements.

Source Code:
http://karma.sugarlabs.org/karma-0.1.tar.gz


Features:

  * Chaining of operations
  * Wrappers for drawing functions
  * API documentation
  * simple mechanism for pre-loading images and audio

Known Bugs:

  * You cannot access the Adding_Up lesson from google chrome or
chromium. It does work if you have the lesson stored on your
local machine. This is because chromium does not yet support
loading media over HTTP.
  * Knavbar with adding up.
  * The links on ‘kstart’ page to Teacher’s Note and Lesson Note
don’t go anywhere
  * The css on stages 2 and 3 of Chakra are all screwed up

Features that didn’t make it into Release 0.1:

  * Internationalization mechanism
  * SVG manipulation
  * Addition of knavbar to adding_up_to_10
  * A refactored version of the Quadrilaterals lesson

Contributors:

  * Bryan Berry
  * Felipe Lopez Toledo
  * Christoph Derndorfer
  * Om Prakash Yadav
  * Rabi Karmacharya
  * Roshan Karki
  * Saurav Dev Bhatta
  * Devendra Khadka
  * Pavel Mocan

Please test out Chakra and our first lesson “Adding up.” We would most
appreciate it if you report any bugs you find to our bugtracker on
launchpad




-- 
Bryan W. Berry
Technology Director
OLE Nepal, http://www.olenepal.org



[jQuery] Help with error script

2009-09-15 Thread Dave Maharaj :: WidePixels.com
I have an ajax function that checks fields to validate and display error
messages.
 
There are multiple messages depending on the error per field in some cases,
to short, to long, already taken, invalid, cant be empty and so onyou
get the idea.
 
My function is like this:
 
function(error) {
 
   if(error.length != 0) {   
   
 
   if ( $('#' + fieldName + '-exists').length == 0 ) 
{ 
  $('#' + fieldName).after('div class=error-message id='+
fieldName +'-exists' + error + '/div');
}

   }
   else {
   $('#' + fieldName + '-exists').remove();
   }
   });
 
But the error never changes once 1 is called so if to short it says too
shortfix the problem and it only shows too short never any other
message. How can i remove the message if its fixed but still return
anothererror if it exists?
 
I tried if ( $('#' + fieldName + '-exists').length != error ) 
so if the error is different display the error but it doesnot remove the
original error
 
Ideas?
 
Thanks
 
Dave 


[jQuery] SimpleModal 1.3 height

2009-09-15 Thread Warren Benedetto

Since upgrading to SimpleModal 1.3 from 1.2.3, I'm having real trouble
with the height of the container. Something somewhere keeps inserting
a height of 84px inline into the container div. Because it's inline I
can't override it with my stylesheets -- the inline styles override
the stylesheet.

- I tried setting the minHeight and maxHeight params, but those don't
help.

- I tried setting the containerCSS with height of 'auto' or 'inherit',
but that doesn't work.

- If I set the containerCss with a height set to a pixel value, it
does override the 84px inline style ... but I don't want a hardcoded
pixel height. The content inside the container is of variable height,
so I need the container to expand to accommodate the height of the
content.

I was using 1.2.3 for the last year or so with no problems, and
nothing in my code changed. The issue began immediately after
upgrading to 1.3, so that must be the source of the problem.

Any thoughts?


[jQuery] [validate] custom validation messages

2009-09-15 Thread Dr Stevens

I'm using the validate plugin to validate ASP.NET webforms on the
client (I'd prefer to not use webforms, but for now I'm stuck with
it).  Because I'm using webforms, I'm trying to get around using the
clientID of server controls.  The metadata plugin works great, but I'd
prefer to not use it because it's gonna blow up my markup.

Is there any way to utilize jQuery.validator.addClassRules to add
custom messages to a rule?  Take the following for instance:

jQuery.validator.addMethod(visible-required, function(value,
element) {
return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addClassRules(fool, {
visible-required: true,
lettersonly: true,
messages: {
visible-required: My specific field must is required,
lettersonly: Letters only fool!
}
});

On a slightly related note, is there any overhead associated with
adding custom validation methods specific to some field only to
override the default message?  Take the following:

jQuery.validator.addMethod(visible-required, function(value,
element) {
return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addMethod(visible-required-fool,
jQuery.validator.methods.visible - required,
My specific field is required);

I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Access to restricted URI denied

2009-09-15 Thread Mikie

I am trying to load a js file on a twisted server.  The html file is
created by a Python script.  The first javascript is loaded.  A second
script is load in the first.  I get Access to restricted URI denied
when loading the second script.  Trying to get jsMath to function on
the server.
Any help would be greatly appreciated.


[jQuery] Using jQuery and Prototype in parallel: breaks in Safari version 2 and 3 on a Mac?

2009-09-15 Thread Michael

Hi,

I am using the Prototype/Scriptaculous and jQuery frameworks in
parallel on my website. I'm slowly migrating to jQuery but need to use
both in the meantime. This doesn't appear to cause any problems in any
version of Internet Explorer  6.0 or Firefox on a PC. However, all
javascript seems to break in versions 2 and 3 of Safari on a Mac. I
have tested this using versions of Safari taken from this website
http://michelf.com/projects/multi-safari/ and Macs with old versions
of Safari installed on them. Is this a problem you guys are familiar
with and if so is there an easy solution?

Thanks


[jQuery] Re: custom validation messages

2009-09-15 Thread Dr Stevens

Hrmm, Jörn's blog comments said to use [validate] in the subject, but
it looks like that got removed.

There was a bug in the code at the end of my post.  Use this instead

jQuery.validator.addMethod(visibleRequired, function(value, element)
{
return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addMethod(visibleRequiredFool,
jQuery.validator.methods.visibleRequired,
My specific field is required);

On Sep 15, 11:32 am, Dr Stevens daverstev...@gmail.com wrote:
 I'm using the validate plugin to validate ASP.NET webforms on the
 client (I'd prefer to not use webforms, but for now I'm stuck with
 it).  Because I'm using webforms, I'm trying to get around using the
 clientID of server controls.  The metadata plugin works great, but I'd
 prefer to not use it because it's gonna blow up my markup.

 Is there any way to utilize jQuery.validator.addClassRules to add
 custom messages to a rule?  Take the following for instance:

 jQuery.validator.addMethod(visible-required, function(value,
 element) {
     return $(element).is(:hidden) || !this.optional(element);

 }, This is required when visible);

 jQuery.validator.addClassRules(fool, {
     visible-required: true,
     lettersonly: true,
     messages: {
         visible-required: My specific field must is required,
         lettersonly: Letters only fool!
     }

 });

 On a slightly related note, is there any overhead associated with
 adding custom validation methods specific to some field only to
 override the default message?  Take the following:

 jQuery.validator.addMethod(visible-required, function(value,
 element) {
     return $(element).is(:hidden) || !this.optional(element);

 }, This is required when visible);

 jQuery.validator.addMethod(visible-required-fool,
     jQuery.validator.methods.visible - required,
     My specific field is required);

 I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Dr Stevens

Thanks for your help.  You always seem to be very quick to respond and
I, along with everyone else I'm sure, am very appreciative.

Great plugin!

On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 You shouldn't use visible-required as the method name. Stick with a
 valid JavaScript identifier (probably should have mentioned that).

 As long as you do that, you can use addMethod to alias existing
 methods with other default messages. On the other hand, addClassRules
 doesn't help at all with messages.

 Jörn

 On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com wrote:

  I'm using the validate plugin to validate ASP.NET webforms on the
  client (I'd prefer to not use webforms, but for now I'm stuck with
  it).  Because I'm using webforms, I'm trying to get around using the
  clientID of server controls.  The metadata plugin works great, but I'd
  prefer to not use it because it's gonna blow up my markup.

  Is there any way to utilize jQuery.validator.addClassRules to add
  custom messages to a rule?  Take the following for instance:

  jQuery.validator.addMethod(visible-required, function(value,
  element) {
     return $(element).is(:hidden) || !this.optional(element);
  }, This is required when visible);

  jQuery.validator.addClassRules(fool, {
     visible-required: true,
     lettersonly: true,
     messages: {
         visible-required: My specific field must is required,
         lettersonly: Letters only fool!
     }
  });

  On a slightly related note, is there any overhead associated with
  adding custom validation methods specific to some field only to
  override the default message?  Take the following:

  jQuery.validator.addMethod(visible-required, function(value,
  element) {
     return $(element).is(:hidden) || !this.optional(element);
  }, This is required when visible);

  jQuery.validator.addMethod(visible-required-fool,
     jQuery.validator.methods.visible - required,
     My specific field is required);

  I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Dr Stevens

Sorry for the spam, fixing the subject

On Sep 15, 12:39 pm, Dr Stevens daverstev...@gmail.com wrote:
 Thanks for your help.  You always seem to be very quick to respond and
 I, along with everyone else I'm sure, am very appreciative.

 Great plugin!

 On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  You shouldn't use visible-required as the method name. Stick with a
  valid JavaScript identifier (probably should have mentioned that).

  As long as you do that, you can use addMethod to alias existing
  methods with other default messages. On the other hand, addClassRules
  doesn't help at all with messages.

  Jörn

  On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com wrote:

   I'm using the validate plugin to validate ASP.NET webforms on the
   client (I'd prefer to not use webforms, but for now I'm stuck with
   it).  Because I'm using webforms, I'm trying to get around using the
   clientID of server controls.  The metadata plugin works great, but I'd
   prefer to not use it because it's gonna blow up my markup.

   Is there any way to utilize jQuery.validator.addClassRules to add
   custom messages to a rule?  Take the following for instance:

   jQuery.validator.addMethod(visible-required, function(value,
   element) {
      return $(element).is(:hidden) || !this.optional(element);
   }, This is required when visible);

   jQuery.validator.addClassRules(fool, {
      visible-required: true,
      lettersonly: true,
      messages: {
          visible-required: My specific field must is required,
          lettersonly: Letters only fool!
      }
   });

   On a slightly related note, is there any overhead associated with
   adding custom validation methods specific to some field only to
   override the default message?  Take the following:

   jQuery.validator.addMethod(visible-required, function(value,
   element) {
      return $(element).is(:hidden) || !this.optional(element);
   }, This is required when visible);

   jQuery.validator.addMethod(visible-required-fool,
      jQuery.validator.methods.visible - required,
      My specific field is required);

   I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Jörn Zaefferer

You shouldn't use visible-required as the method name. Stick with a
valid JavaScript identifier (probably should have mentioned that).

As long as you do that, you can use addMethod to alias existing
methods with other default messages. On the other hand, addClassRules
doesn't help at all with messages.

Jörn

On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com wrote:

 I'm using the validate plugin to validate ASP.NET webforms on the
 client (I'd prefer to not use webforms, but for now I'm stuck with
 it).  Because I'm using webforms, I'm trying to get around using the
 clientID of server controls.  The metadata plugin works great, but I'd
 prefer to not use it because it's gonna blow up my markup.

 Is there any way to utilize jQuery.validator.addClassRules to add
 custom messages to a rule?  Take the following for instance:

 jQuery.validator.addMethod(visible-required, function(value,
 element) {
    return $(element).is(:hidden) || !this.optional(element);
 }, This is required when visible);

 jQuery.validator.addClassRules(fool, {
    visible-required: true,
    lettersonly: true,
    messages: {
        visible-required: My specific field must is required,
        lettersonly: Letters only fool!
    }
 });

 On a slightly related note, is there any overhead associated with
 adding custom validation methods specific to some field only to
 override the default message?  Take the following:

 jQuery.validator.addMethod(visible-required, function(value,
 element) {
    return $(element).is(:hidden) || !this.optional(element);
 }, This is required when visible);

 jQuery.validator.addMethod(visible-required-fool,
    jQuery.validator.methods.visible - required,
    My specific field is required);

 I saw your talk at the conference last weekend btw.  Thanks



[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Jörn Zaefferer

I actually changed the plugin page to ask for (validate). When you
use Google Groups in an email client, the subject is displayed just
fined, while the Web interface removes the prefix.

Jörn

On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens daverstev...@gmail.com wrote:

 Sorry for the spam, fixing the subject

 On Sep 15, 12:39 pm, Dr Stevens daverstev...@gmail.com wrote:
 Thanks for your help.  You always seem to be very quick to respond and
 I, along with everyone else I'm sure, am very appreciative.

 Great plugin!

 On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  You shouldn't use visible-required as the method name. Stick with a
  valid JavaScript identifier (probably should have mentioned that).

  As long as you do that, you can use addMethod to alias existing
  methods with other default messages. On the other hand, addClassRules
  doesn't help at all with messages.

  Jörn

  On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com wrote:

   I'm using the validate plugin to validate ASP.NET webforms on the
   client (I'd prefer to not use webforms, but for now I'm stuck with
   it).  Because I'm using webforms, I'm trying to get around using the
   clientID of server controls.  The metadata plugin works great, but I'd
   prefer to not use it because it's gonna blow up my markup.

   Is there any way to utilize jQuery.validator.addClassRules to add
   custom messages to a rule?  Take the following for instance:

   jQuery.validator.addMethod(visible-required, function(value,
   element) {
      return $(element).is(:hidden) || !this.optional(element);
   }, This is required when visible);

   jQuery.validator.addClassRules(fool, {
      visible-required: true,
      lettersonly: true,
      messages: {
          visible-required: My specific field must is required,
          lettersonly: Letters only fool!
      }
   });

   On a slightly related note, is there any overhead associated with
   adding custom validation methods specific to some field only to
   override the default message?  Take the following:

   jQuery.validator.addMethod(visible-required, function(value,
   element) {
      return $(element).is(:hidden) || !this.optional(element);
   }, This is required when visible);

   jQuery.validator.addMethod(visible-required-fool,
      jQuery.validator.methods.visible - required,
      My specific field is required);

   I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Dr Stevens

gotcha, figured that out after my last post.

I actually got here from your last comment on http://bassistance.de/
jquery-plugins/jquery-plugin-validation/.  I will make note to use
(validate) instead.

On Sep 15, 12:47 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 I actually changed the plugin page to ask for (validate). When you
 use Google Groups in an email client, the subject is displayed just
 fined, while the Web interface removes the prefix.

 Jörn

 On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens daverstev...@gmail.com wrote:

  Sorry for the spam, fixing the subject

  On Sep 15, 12:39 pm, Dr Stevens daverstev...@gmail.com wrote:
  Thanks for your help.  You always seem to be very quick to respond and
  I, along with everyone else I'm sure, am very appreciative.

  Great plugin!

  On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:

   You shouldn't use visible-required as the method name. Stick with a
   valid JavaScript identifier (probably should have mentioned that).

   As long as you do that, you can use addMethod to alias existing
   methods with other default messages. On the other hand, addClassRules
   doesn't help at all with messages.

   Jörn

   On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com 
   wrote:

I'm using the validate plugin to validate ASP.NET webforms on the
client (I'd prefer to not use webforms, but for now I'm stuck with
it).  Because I'm using webforms, I'm trying to get around using the
clientID of server controls.  The metadata plugin works great, but I'd
prefer to not use it because it's gonna blow up my markup.

Is there any way to utilize jQuery.validator.addClassRules to add
custom messages to a rule?  Take the following for instance:

jQuery.validator.addMethod(visible-required, function(value,
element) {
   return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addClassRules(fool, {
   visible-required: true,
   lettersonly: true,
   messages: {
       visible-required: My specific field must is required,
       lettersonly: Letters only fool!
   }
});

On a slightly related note, is there any overhead associated with
adding custom validation methods specific to some field only to
override the default message?  Take the following:

jQuery.validator.addMethod(visible-required, function(value,
element) {
   return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addMethod(visible-required-fool,
   jQuery.validator.methods.visible - required,
   My specific field is required);

I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Jörn Zaefferer

Ah, thanks for the hint, forgot to update that comment. Fixed it now!

Jörn

On Tue, Sep 15, 2009 at 6:52 PM, Dr Stevens daverstev...@gmail.com wrote:

 gotcha, figured that out after my last post.

 I actually got here from your last comment on http://bassistance.de/
 jquery-plugins/jquery-plugin-validation/.  I will make note to use
 (validate) instead.

 On Sep 15, 12:47 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 I actually changed the plugin page to ask for (validate). When you
 use Google Groups in an email client, the subject is displayed just
 fined, while the Web interface removes the prefix.

 Jörn

 On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens daverstev...@gmail.com wrote:

  Sorry for the spam, fixing the subject

  On Sep 15, 12:39 pm, Dr Stevens daverstev...@gmail.com wrote:
  Thanks for your help.  You always seem to be very quick to respond and
  I, along with everyone else I'm sure, am very appreciative.

  Great plugin!

  On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:

   You shouldn't use visible-required as the method name. Stick with a
   valid JavaScript identifier (probably should have mentioned that).

   As long as you do that, you can use addMethod to alias existing
   methods with other default messages. On the other hand, addClassRules
   doesn't help at all with messages.

   Jörn

   On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com 
   wrote:

I'm using the validate plugin to validate ASP.NET webforms on the
client (I'd prefer to not use webforms, but for now I'm stuck with
it).  Because I'm using webforms, I'm trying to get around using the
clientID of server controls.  The metadata plugin works great, but I'd
prefer to not use it because it's gonna blow up my markup.

Is there any way to utilize jQuery.validator.addClassRules to add
custom messages to a rule?  Take the following for instance:

jQuery.validator.addMethod(visible-required, function(value,
element) {
   return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addClassRules(fool, {
   visible-required: true,
   lettersonly: true,
   messages: {
       visible-required: My specific field must is required,
       lettersonly: Letters only fool!
   }
});

On a slightly related note, is there any overhead associated with
adding custom validation methods specific to some field only to
override the default message?  Take the following:

jQuery.validator.addMethod(visible-required, function(value,
element) {
   return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addMethod(visible-required-fool,
   jQuery.validator.methods.visible - required,
   My specific field is required);

I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: which submit button was clicked?

2009-09-15 Thread jlcox

script language=JavaScript type=text/javascript
$(document).ready(function() {
  $(#button1, #button2).click(function(event) {
event.preventDefault();
alert($(this).attr(id) +  was clicked);
  });
});
/script
/head
body
form id=form1
  input type=submit id=button1 value=Submit /
  input type=submit id=button2 value=Submit Again /
/form
/body


[jQuery] Re: Get the onclick method of an element

2009-09-15 Thread sirrocco _
Damn ... I somehow thought this would be easy to achive .

The whole idea was to not change existing code 

Still .. if anyone has any more ideas :). Somehow it seems that this should
be doable.

On Tue, Sep 15, 2009 at 6:03 PM, MiKiTiE mikiji...@googlemail.com wrote:


 Ok, I've done some tests and here is my suggestion.

 First of all, should just ask - I assume you are calling it after the
 element? Probably is obvious, but thought I'd check.

 Ok, here's the deal: onclick is not really an attribute but a mouse
 event. Therefore jQuery will take the contents as a function and write
 it out as an event. The only alternative is to insert your DoSomething
 (this); into a standard attribute like title or alt and then take
 it from there. This way you should be able to insert it exactly as its
 written and not have it converted into an event.

 Hope this will help?

 On Sep 15, 2:31 pm, sirrocco xavier...@gmail.com wrote:
  Perhaps then you can extract it as text like I mentioned in my first
 
  post, then store it in a variable?
 
  How do I extract it like text ? Calling the .text() method, as
  expected doesn't return what I need - DoSomething(this);
 
  On Sep 15, 3:30 pm,MiKiTiEmikiji...@googlemail.com wrote:
 
   Perhaps then you can extract it as text like I mentioned in my first
   post, then store it in a variable?
 
   As I am not sure what your function does or why it needs to be applied
   this way, I can't solve the problem exactly - but why not just use an
   event instead of an onclick in the element? That is what jQuery is
   there for :-)
 
   On Sep 15, 9:50 am, sirrocco xavier...@gmail.com wrote:
 
Well .. that's the problem - i tried it like that and it didn't work.
 
When setting the attribute back on the link, the this in DoSomething
(this); is not the link, but the window.
 
On Sep 15, 11:41 am,MiKiTiEmikiji...@googlemail.com wrote:
 
 Sorry I should have written
 
 $('a').attr('onclick',onclick);
 
 (setting the attribute value not the inner text!)
 
 On Sep 15, 9:09 am, sirrocco xavier...@gmail.com wrote:
 
  Let's say you have a :
 
  a href=# onclick='DoSomething(this);'asd/a
 
  I want to get the onclick text in a variable - something like
 
  var onclick = $('a').attr('onclick');
 
  The problem is that the onclick variable now is a function and if
 I
  try to execute , this   wil be the document instead of the link .
 
  How can I get only the text, so I can later reattach it to the
 link ?
 



[jQuery] Re: droppable limit

2009-09-15 Thread Boris Trivic

Other solution is to add next code below ...drop: function(){...

$(this).droppable('disable');

logicaly, it will disable drop on element...

If you want enable drop, again, add next code below ...out: function
(event, ui) {...

$(this).droppable('disable');

Hope it helps...

On Sep 8, 3:27 am, Richard D. Worth rdwo...@gmail.com wrote:
 The accept option can take a function. That function gets called when a
 draggable starts being dragged and the draggable item is sent as the first
 argument to the function. So if your droppable already has an item, simply
 return false in that function, otherwise return true. The other option would
 be to disable or destroy your droppable, once it has an item.
 - Richard

 On Sat, Sep 5, 2009 at 10:16 AM, pEeLL milan.h...@gmail.com wrote:

  Hi

  i use for drag and drop this easy code

  $(function() {

 $(.ui-draggable).draggable({ revert: 'invalid' });

 $(.ui-droppable).droppable({
 accept: '.ui-draggable',
 drop: function(event, ui) {
 $(this).addClass('red');
 },
 out: function(event, ui) {
 $(this).removeClass('red');
 }
 });
  });

  i have some boxes and some containers. i  want add ONLY one box to one
  container. How can i limit number of boxex that will container
  accept?  thanks for every help.


[jQuery] dynamic loading of content from json file: questions about performance and best practices

2009-09-15 Thread roryreiff

Hello,

I am in the process of creating a slideshow/gallery of 5 'panes', each
of which will have some interactive content with hover/click behaviour
and hidden/animated sections of content that can be accessed and
manipulated. Currently, the gallery is pulling in each 'pane' from a
json file. It is randomizing the starting pane though, and I would
like to optimize the loading of the json file such that the variable
that is being set to determine the starting pane determines which part
of the json file is loaded first.

Im assuming its pretty easy to load a particular portion of a json
file first before the others, though I have yet to try and implement
this. I am more interested in best practices/performance boosts in
relation to loading the different parts of the json file. I imagine a
scenario in which a loading icon is visible until the entirety of each
pane is loaded. Does anyone have input as to what I should take into
consideration in terms of making sure I am loading the 5 'panes' from
the json file in order of appearance on the page and not in the json
file? Thanks,


[jQuery] How to check is element droppable

2009-09-15 Thread Boris Trivic

Hi.

How I can check this? I have next part of code where I must check is
element tag = droppable.

Instead code after // pseudo: i must add some function that check if
element is droppable. If true it must write some text in that element
(For example: $(tag).text('bla bla') )

// code /
function help(){
// array generated by PHP:
?=$correct?
// random num. from upper array:
var rand = Math.floor( Math.random() * cor.length );
// Set tag
if(rand != 0){
var tag = '#p'+rand;
}
// here goes code that check if tag is
droppable...
   /// pseudo:
   if(tag is droppable){
alert('is dropable');
   }
}
 CODE /


[jQuery] Re: How to check is element droppable

2009-09-15 Thread Boris Trivic

if question isn't clear, I can explain better :)

On Sep 15, 7:33 pm, Boris Trivic trivu...@gmail.com wrote:
 Hi.

 How I can check this? I have next part of code where I must check is
 element tag = droppable.

 Instead code after // pseudo: i must add some function that check if
 element is droppable. If true it must write some text in that element
 (For example: $(tag).text('bla bla') )

 // code /
 function help(){
 // array generated by PHP:
 ?=$correct?
 // random num. from upper array:
 var rand = Math.floor( Math.random() * cor.length );
 // Set tag
 if(rand != 0){
 var tag = '#p'+rand;
 }
 // here goes code that check if tag is
 droppable...
/// pseudo:
if(tag is droppable){
 alert('is dropable');
}}

  CODE /


[jQuery] Re: IE 8 chokes on HTML5 elements inserted with jQuery

2009-09-15 Thread Ricardo

Regarding #1, he is already doing that (in html5.js). IE fails to
parse the new elements in innerHTML even after introducing the new
tags via createElement.

#2 works fine. If you provide jQuery a single tag then it will use
createElement, ex:

$('article/')
  .append( $('header/').append( $('a href=http://
www.w3.orgGuest/a') )
  .append( $('section/').append( $('pThis is the comment/
p') ) );

cheers
Ricardo

On Sep 15, 9:29 am, Nick Fitzsimons n...@nickfitz.co.uk wrote:
 2009/9/15 Perceptes jimmycua...@gmail.com:



  I've encountered a problem with the combination of jQuery, IE, and
  HTML5 elements. HTML5 elements inserted into the page after initial
  load via jQuery's DOM manipulation functions are not parsed correctly
  by IE, even with Remy Sharp's HTML5 shiv script.

 The problem is that jQuery uses innerHTML, rather than DOM methods, to
 insert the new content (which is why it's passed to jQuery as a
 string). This means it relies on IE's HTML parser to correctly parse
 the markup from the string when it is inserted.

 When IE's parser encounters an element it doesn't recognise the name
 of, it creates the element as an empty element (similar to br or
 img), then parses the content as if it were sibling nodes, then
 creates an empty element whose name begins with a slash (/ARTICLE for
 example); you can see this on your test page by clicking on the IE
 fail button and then entering:
 javascript:alert(document.body.childNodes[0].childNodes[1].firstChild.tagN 
 ame)
 and
 javascript:alert(document.body.childNodes[0].childNodes[1].lastChild.tagNa 
 me)
 in the location bar; the first will show ARTICLE, and the second
 will show /ARTICLE.

 To work around this you basically have two options:

 1. Before any other script is executed, add the line:
 document.createElement(article);
 and add equivalent lines for any other HTML5-specific elements you
 wish to use (such as section). This prompts IE's HTML parser to expect
 blocks with that tagName and it will then parse them correctly.

 2. Don't use jQuery's innerHTML-dependent approach to creating new
 content; instead, use DOM creation methods directly, for example:

 var article = document.createElement(article);
 var header = article.appendChild(document.createElement(header));
 header.appendChild(document.createTextNode(Hello World);

 var container = document.getElementsByTagName(div)[0];
 container.insertBefore(article, container .getElementsByTagName(h2)[1]);

 ... and so on. (Actually, you can use jQuery for selecting the correct
 insertion point and for inserting the new elements there, as jQuery
 can cope with elements when inserting content.)

 Regards,

 Nick.
 --
 Nick Fitzsimonshttp://www.nickfitz.co.uk/


[jQuery] Re: SimpleModal 1.3 height

2009-09-15 Thread Warren Benedetto

Figured it out myself, so I'm posting for anyone else with this
problem. Adding !important to the height specified in my stylesheet
overrides the inline style. Not sure if that's the best solution, but
it works.


[jQuery] Re: Very disappointed with jquery and iframe communication

2009-09-15 Thread Ricardo

You can also access the frame's contents via $('#frame_id').contents
().find('xx'), I think.

On Sep 15, 9:42 am, Paolo Chiodi chiod...@gmail.com wrote:
 Of course it doesn't work.
 You are searching for node elements with id=login that are child of
 your iframes. You need to use the dom of the page loaded inside the i
 frame
 try $(frames['Theiframe']).get(0).contentDocument

 I in the content page is present jquery, use
 $(frames['Theiframe']).get(0).contentWindow.$('#login')

 BTW, you can access child dom only if in same domain

 Paolo



 On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas igguan...@yahoo.com wrote:

  After 1 day googling and trying I find no agreement in a solid method for 
  comunicating with iframe, this is the nearest point I've been to get in 
  touch with IFRAME:

  $(frames['Theiframe']).ready( function ()
  {
      alert('Frame is loaded');

  });

  This will alert the message, but any attempt to comunicate with the iframe 
  and access it's contents have been useless, I have a hidden field with with 
  ID login and I'm trying to get it's value:

  $(frames['Theiframe']).find(#login).val(); //Doesn't work in FF 3.0.14

  /// 
  //

  var $currentIFrame = $(frames['Theiframe']);
  $currentIFrame.contents().find(body #login).val() //Neither does in FF 
  3.0.14

  If you Google a few you will see that everyone is giving it's own opinion 
  on how to do it, but there's no agreement and no crossbrowser solid 
  solution...


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

And what if you enter an invalid character in an input at the bottom
of the field? For example entering a letter in the Conference Dinner
input of my sample form.

A user is going to miss the error message at the top of the form along
with other input errors if there's an error in the last inputs of my
example form and is going to have submit multiple times before they
may even be aware of other errors.

I'd expected jumping to the first invalid input to be standard
behaviour.  My fault there I guess.




On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Whats wrong with keeping the focus on the active field, if its invalid?

 If you enter something into the, say, third field, hit enter to
 submit, then it turns out both that field and another before that are
 invalid, why move the focus to a different field?

 Jörn



 On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com wrote:

  I've been building up my validation using the jquery validation plugin
  but I can't work out how to get a failed validation to default the
  focus to the first invalid input rather than to the last selected
  input.

  If there is no input field selected, when I submit then a failed
  validation will focus the cursor on the first field but if the cursor
  was left in a field and submitted then the focus stays there (if it's
  invalid) rather than jump to the first invalid input.  From what I've
  read and seen, this is the expected behaviour but not what I want.

  Is there a way I can get the first invalid field and set the focus to
  that?

  A demo of what I have built up so far can be seen at
 https://webdev2.otago.ac.nz/oihrn2009/

  All my jquery validation can be found in
 https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer

Well, you can set focusInvalid: false and implement invalidHandler to
focus the first field. That should do the trick.

Jörn

On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com wrote:

 And what if you enter an invalid character in an input at the bottom
 of the field? For example entering a letter in the Conference Dinner
 input of my sample form.

 A user is going to miss the error message at the top of the form along
 with other input errors if there's an error in the last inputs of my
 example form and is going to have submit multiple times before they
 may even be aware of other errors.

 I'd expected jumping to the first invalid input to be standard
 behaviour.  My fault there I guess.




 On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 Whats wrong with keeping the focus on the active field, if its invalid?

 If you enter something into the, say, third field, hit enter to
 submit, then it turns out both that field and another before that are
 invalid, why move the focus to a different field?

 Jörn



 On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com wrote:

  I've been building up my validation using the jquery validation plugin
  but I can't work out how to get a failed validation to default the
  focus to the first invalid input rather than to the last selected
  input.

  If there is no input field selected, when I submit then a failed
  validation will focus the cursor on the first field but if the cursor
  was left in a field and submitted then the focus stays there (if it's
  invalid) rather than jump to the first invalid input.  From what I've
  read and seen, this is the expected behaviour but not what I want.

  Is there a way I can get the first invalid field and set the focus to
  that?

  A demo of what I have built up so far can be seen at
 https://webdev2.otago.ac.nz/oihrn2009/

  All my jquery validation can be found in
 https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: SimpleModal 1.3 height

2009-09-15 Thread Eric Martin

Warren,

Can you send me (or better yet create an issue[1]) with a working code
sample of the issue you are having?

Thanks,
Eric

[1] http://code.google.com/p/simplemodal/issues/list

On Sep 15, 12:09 pm, Warren Benedetto war...@transfusionmedia.com
wrote:
 Figured it out myself, so I'm posting for anyone else with this
 problem. Adding !important to the height specified in my stylesheet
 overrides the inline style. Not sure if that's the best solution, but
 it works.


[jQuery] Re: each() needs documentation

2009-09-15 Thread Jānis

Yes, I really looked for it - in traversing, manipulation, and also
core. But probably somehow skipped over where it was. Thank you for
the link!


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

I guess I'm going to have too.  I just need to work out how to return
the first invalid field so I can set the focus.



On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Well, you can set focusInvalid: false and implement invalidHandler to
 focus the first field. That should do the trick.

 Jörn



 On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com wrote:

  And what if you enter an invalid character in an input at the bottom
  of the field? For example entering a letter in the Conference Dinner
  input of my sample form.

  A user is going to miss the error message at the top of the form along
  with other input errors if there's an error in the last inputs of my
  example form and is going to have submit multiple times before they
  may even be aware of other errors.

  I'd expected jumping to the first invalid input to be standard
  behaviour.  My fault there I guess.

  On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:
  Whats wrong with keeping the focus on the active field, if its invalid?

  If you enter something into the, say, third field, hit enter to
  submit, then it turns out both that field and another before that are
  invalid, why move the focus to a different field?

  Jörn

  On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com wrote:

   I've been building up my validation using the jquery validation plugin
   but I can't work out how to get a failed validation to default the
   focus to the first invalid input rather than to the last selected
   input.

   If there is no input field selected, when I submit then a failed
   validation will focus the cursor on the first field but if the cursor
   was left in a field and submitted then the focus stays there (if it's
   invalid) rather than jump to the first invalid input.  From what I've
   read and seen, this is the expected behaviour but not what I want.

   Is there a way I can get the first invalid field and set the focus to
   that?

   A demo of what I have built up so far can be seen at
  https://webdev2.otago.ac.nz/oihrn2009/

   All my jquery validation can be found in
  https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer

Something like this?

$(form).validate({
  focusInvalid: false,
  invalidHandler: function() {
$(this).find(:input.error:first).focus();
  }
});

Jörn

On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com wrote:

 I guess I'm going to have too.  I just need to work out how to return
 the first invalid field so I can set the focus.



 On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 Well, you can set focusInvalid: false and implement invalidHandler to
 focus the first field. That should do the trick.

 Jörn



 On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com wrote:

  And what if you enter an invalid character in an input at the bottom
  of the field? For example entering a letter in the Conference Dinner
  input of my sample form.

  A user is going to miss the error message at the top of the form along
  with other input errors if there's an error in the last inputs of my
  example form and is going to have submit multiple times before they
  may even be aware of other errors.

  I'd expected jumping to the first invalid input to be standard
  behaviour.  My fault there I guess.

  On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:
  Whats wrong with keeping the focus on the active field, if its invalid?

  If you enter something into the, say, third field, hit enter to
  submit, then it turns out both that field and another before that are
  invalid, why move the focus to a different field?

  Jörn

  On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   I've been building up my validation using the jquery validation plugin
   but I can't work out how to get a failed validation to default the
   focus to the first invalid input rather than to the last selected
   input.

   If there is no input field selected, when I submit then a failed
   validation will focus the cursor on the first field but if the cursor
   was left in a field and submitted then the focus stays there (if it's
   invalid) rather than jump to the first invalid input.  From what I've
   read and seen, this is the expected behaviour but not what I want.

   Is there a way I can get the first invalid field and set the focus to
   that?

   A demo of what I have built up so far can be seen at
  https://webdev2.otago.ac.nz/oihrn2009/

   All my jquery validation can be found in
  https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

Damn.  I always forget about :first.

Thanks.



On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Something like this?

 $(form).validate({
   focusInvalid: false,
   invalidHandler: function() {
     $(this).find(:input.error:first).focus();
   }

 });

 Jörn



 On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com wrote:

  I guess I'm going to have too.  I just need to work out how to return
  the first invalid field so I can set the focus.

  On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:
  Well, you can set focusInvalid: false and implement invalidHandler to
  focus the first field. That should do the trick.

  Jörn

  On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   And what if you enter an invalid character in an input at the bottom
   of the field? For example entering a letter in the Conference Dinner
   input of my sample form.

   A user is going to miss the error message at the top of the form along
   with other input errors if there's an error in the last inputs of my
   example form and is going to have submit multiple times before they
   may even be aware of other errors.

   I'd expected jumping to the first invalid input to be standard
   behaviour.  My fault there I guess.

   On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
   wrote:
   Whats wrong with keeping the focus on the active field, if its invalid?

   If you enter something into the, say, third field, hit enter to
   submit, then it turns out both that field and another before that are
   invalid, why move the focus to a different field?

   Jörn

   On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com 
   wrote:

I've been building up my validation using the jquery validation plugin
but I can't work out how to get a failed validation to default the
focus to the first invalid input rather than to the last selected
input.

If there is no input field selected, when I submit then a failed
validation will focus the cursor on the first field but if the cursor
was left in a field and submitted then the focus stays there (if it's
invalid) rather than jump to the first invalid input.  From what I've
read and seen, this is the expected behaviour but not what I want.

Is there a way I can get the first invalid field and set the focus to
that?

A demo of what I have built up so far can be seen at
   https://webdev2.otago.ac.nz/oihrn2009/

All my jquery validation can be found in
   https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: (validate) email validator

2009-09-15 Thread Scott Haneda


Right, this is sort of a long debate, which I see pop up on mailing  
lists for email servers.  In the end, I think you need to go by the  
standards.


Just because hotmail breaks the rules, does not mean you want to  
punish some other user who does not use hotmail, just because they use  
a character in their email address that hotmail does not.


On Sep 14, 2009, at 6:04 PM, Sean McKenna wrote:


While technically this is correct, a more restrictive approach might
be preferable because some email services (hotmail for one) will not
send to an email address using anything other than alphanumerics,
dots, hyphens, and underscores.


--
Scott * If you contact me off list replace talklists@ with scott@ *



[jQuery] Re: (validate) email validator

2009-09-15 Thread Jörn Zaefferer

Yep. The goal here is to indicate to the user that he mistyped his
address. For that to work reliably, the validation must accept all
valid addresses, not just those that feel more valid then others.

Jörn

On Tue, Sep 15, 2009 at 10:39 PM, Scott Haneda talkli...@newgeo.com wrote:

 Right, this is sort of a long debate, which I see pop up on mailing lists
 for email servers.  In the end, I think you need to go by the standards.

 Just because hotmail breaks the rules, does not mean you want to punish some
 other user who does not use hotmail, just because they use a character in
 their email address that hotmail does not.

 On Sep 14, 2009, at 6:04 PM, Sean McKenna wrote:

 While technically this is correct, a more restrictive approach might
 be preferable because some email services (hotmail for one) will not
 send to an email address using anything other than alphanumerics,
 dots, hyphens, and underscores.

 --
 Scott * If you contact me off list replace talklists@ with scott@ *




[jQuery] Re: IE 8 chokes on HTML5 elements inserted with jQuery

2009-09-15 Thread Perceptes

Fantastic!! Thanks for those excellent replies! Much appreciated. :D

On Sep 15, 12:07 pm, Ricardo ricardob...@gmail.com wrote:
 Regarding #1, he is already doing that (in html5.js). IE fails to
 parse the new elements in innerHTML even after introducing the new
 tags via createElement.

 #2 works fine. If you provide jQuery a single tag then it will use
 createElement, ex:

 $('article/')
   .append( $('header/').append( $('a href=http://www.w3.org;Guest/a') )
   .append( $('section/').append( $('pThis is the comment/
 p') ) );

 cheers
 Ricardo

 On Sep 15, 9:29 am, Nick Fitzsimons n...@nickfitz.co.uk wrote:



  2009/9/15 Perceptes jimmycua...@gmail.com:

   I've encountered a problem with the combination of jQuery, IE, and
   HTML5 elements. HTML5 elements inserted into the page after initial
   load via jQuery's DOM manipulation functions are not parsed correctly
   by IE, even with Remy Sharp's HTML5 shiv script.

  The problem is that jQuery uses innerHTML, rather than DOM methods, to
  insert the new content (which is why it's passed to jQuery as a
  string). This means it relies on IE's HTML parser to correctly parse
  the markup from the string when it is inserted.

  When IE's parser encounters an element it doesn't recognise the name
  of, it creates the element as an empty element (similar to br or
  img), then parses the content as if it were sibling nodes, then
  creates an empty element whose name begins with a slash (/ARTICLE for
  example); you can see this on your test page by clicking on the IE
  fail button and then entering:
  javascript:alert(document.body.childNodes[0].childNodes[1].firstChild.tagN 
  ame)
  and
  javascript:alert(document.body.childNodes[0].childNodes[1].lastChild.tagNa 
  me)
  in the location bar; the first will show ARTICLE, and the second
  will show /ARTICLE.

  To work around this you basically have two options:

  1. Before any other script is executed, add the line:
  document.createElement(article);
  and add equivalent lines for any other HTML5-specific elements you
  wish to use (such as section). This prompts IE's HTML parser to expect
  blocks with that tagName and it will then parse them correctly.

  2. Don't use jQuery's innerHTML-dependent approach to creating new
  content; instead, use DOM creation methods directly, for example:

  var article = document.createElement(article);
  var header = article.appendChild(document.createElement(header));
  header.appendChild(document.createTextNode(Hello World);

  var container = document.getElementsByTagName(div)[0];
  container.insertBefore(article, container .getElementsByTagName(h2)[1]);

  ... and so on. (Actually, you can use jQuery for selecting the correct
  insertion point and for inserting the new elements there, as jQuery
  can cope with elements when inserting content.)

  Regards,

  Nick.
  --
  Nick Fitzsimonshttp://www.nickfitz.co.uk/


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

Hmmm...I tried this but I discovered on the first submit that it
doesn't focus the first invalid field but it will if I hit return to
submit again.

Also, when hitting submit on a field that's not checked for validity,
the form will submit successfully this second time as well despite
still having invalid fields.

You can test it out using my sample form from the OP.


On Sep 16, 8:37 am, Geoffrey geoffreydhug...@gmail.com wrote:
 Damn.  I always forget about :first.

 Thanks.

 On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:



  Something like this?

  $(form).validate({
    focusInvalid: false,
    invalidHandler: function() {
      $(this).find(:input.error:first).focus();
    }

  });

  Jörn

  On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   I guess I'm going to have too.  I just need to work out how to return
   the first invalid field so I can set the focus.

   On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
   wrote:
   Well, you can set focusInvalid: false and implement invalidHandler to
   focus the first field. That should do the trick.

   Jörn

   On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com 
   wrote:

And what if you enter an invalid character in an input at the bottom
of the field? For example entering a letter in the Conference Dinner
input of my sample form.

A user is going to miss the error message at the top of the form along
with other input errors if there's an error in the last inputs of my
example form and is going to have submit multiple times before they
may even be aware of other errors.

I'd expected jumping to the first invalid input to be standard
behaviour.  My fault there I guess.

On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
Whats wrong with keeping the focus on the active field, if its 
invalid?

If you enter something into the, say, third field, hit enter to
submit, then it turns out both that field and another before that are
invalid, why move the focus to a different field?

Jörn

On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com 
wrote:

 I've been building up my validation using the jquery validation 
 plugin
 but I can't work out how to get a failed validation to default the
 focus to the first invalid input rather than to the last selected
 input.

 If there is no input field selected, when I submit then a failed
 validation will focus the cursor on the first field but if the 
 cursor
 was left in a field and submitted then the focus stays there (if 
 it's
 invalid) rather than jump to the first invalid input.  From what 
 I've
 read and seen, this is the expected behaviour but not what I want.

 Is there a way I can get the first invalid field and set the focus 
 to
 that?

 A demo of what I have built up so far can be seen at
https://webdev2.otago.ac.nz/oihrn2009/

 All my jquery validation can be found in
https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer

I can't reproduce that. Seems to work fine for me.

Jörn

On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey geoffreydhug...@gmail.com wrote:

 Hmmm...I tried this but I discovered on the first submit that it
 doesn't focus the first invalid field but it will if I hit return to
 submit again.

 Also, when hitting submit on a field that's not checked for validity,
 the form will submit successfully this second time as well despite
 still having invalid fields.

 You can test it out using my sample form from the OP.


 On Sep 16, 8:37 am, Geoffrey geoffreydhug...@gmail.com wrote:
 Damn.  I always forget about :first.

 Thanks.

 On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:



  Something like this?

  $(form).validate({
    focusInvalid: false,
    invalidHandler: function() {
      $(this).find(:input.error:first).focus();
    }

  });

  Jörn

  On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   I guess I'm going to have too.  I just need to work out how to return
   the first invalid field so I can set the focus.

   On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
   wrote:
   Well, you can set focusInvalid: false and implement invalidHandler to
   focus the first field. That should do the trick.

   Jörn

   On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com 
   wrote:

And what if you enter an invalid character in an input at the bottom
of the field? For example entering a letter in the Conference Dinner
input of my sample form.

A user is going to miss the error message at the top of the form along
with other input errors if there's an error in the last inputs of my
example form and is going to have submit multiple times before they
may even be aware of other errors.

I'd expected jumping to the first invalid input to be standard
behaviour.  My fault there I guess.

On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
Whats wrong with keeping the focus on the active field, if its 
invalid?

If you enter something into the, say, third field, hit enter to
submit, then it turns out both that field and another before that are
invalid, why move the focus to a different field?

Jörn

On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com 
wrote:

 I've been building up my validation using the jquery validation 
 plugin
 but I can't work out how to get a failed validation to default the
 focus to the first invalid input rather than to the last selected
 input.

 If there is no input field selected, when I submit then a failed
 validation will focus the cursor on the first field but if the 
 cursor
 was left in a field and submitted then the focus stays there (if 
 it's
 invalid) rather than jump to the first invalid input.  From what 
 I've
 read and seen, this is the expected behaviour but not what I want.

 Is there a way I can get the first invalid field and set the focus 
 to
 that?

 A demo of what I have built up so far can be seen at
https://webdev2.otago.ac.nz/oihrn2009/

 All my jquery validation can be found in
https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

Not for me.

In Safari 4 and Firefox 3.5.3 under Snow Leopard and Firefox 3.5.3
under XP:

Click in a required field (not the first one) and hit return.  Focus
stays in the focused field.  Hit return again and the focus jumps to
the first invalid field.

If you focus a non-required field and hit return, the focus stays in
the non-required field but you do get the error messages for invalid
fields.  If you hit return again, the focus jumps to the first invalid
field but then the form submits successfully.


In Internet Explorer 7 under XP:

Click in required field (not the first one) and hit return.  Focus
stays in the focused field.  Hit return again and the focus stays in
the focused field.

If you focus on a non-required element and hit return, the focus jumps
to the first invalid field.







On Sep 16, 9:44 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 I can't reproduce that. Seems to work fine for me.

 Jörn



 On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey geoffreydhug...@gmail.com wrote:

  Hmmm...I tried this but I discovered on the first submit that it
  doesn't focus the first invalid field but it will if I hit return to
  submit again.

  Also, when hitting submit on a field that's not checked for validity,
  the form will submit successfully this second time as well despite
  still having invalid fields.

  You can test it out using my sample form from the OP.

  On Sep 16, 8:37 am, Geoffrey geoffreydhug...@gmail.com wrote:
  Damn.  I always forget about :first.

  Thanks.

  On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:

   Something like this?

   $(form).validate({
     focusInvalid: false,
     invalidHandler: function() {
       $(this).find(:input.error:first).focus();
     }

   });

   Jörn

   On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com 
   wrote:

I guess I'm going to have too.  I just need to work out how to return
the first invalid field so I can set the focus.

On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
Well, you can set focusInvalid: false and implement invalidHandler to
focus the first field. That should do the trick.

Jörn

On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey 
geoffreydhug...@gmail.com wrote:

 And what if you enter an invalid character in an input at the bottom
 of the field? For example entering a letter in the Conference Dinner
 input of my sample form.

 A user is going to miss the error message at the top of the form 
 along
 with other input errors if there's an error in the last inputs of my
 example form and is going to have submit multiple times before they
 may even be aware of other errors.

 I'd expected jumping to the first invalid input to be standard
 behaviour.  My fault there I guess.

 On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 Whats wrong with keeping the focus on the active field, if its 
 invalid?

 If you enter something into the, say, third field, hit enter to
 submit, then it turns out both that field and another before that 
 are
 invalid, why move the focus to a different field?

 Jörn

 On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey 
 geoffreydhug...@gmail.com wrote:

  I've been building up my validation using the jquery validation 
  plugin
  but I can't work out how to get a failed validation to default 
  the
  focus to the first invalid input rather than to the last selected
  input.

  If there is no input field selected, when I submit then a failed
  validation will focus the cursor on the first field but if the 
  cursor
  was left in a field and submitted then the focus stays there (if 
  it's
  invalid) rather than jump to the first invalid input.  From what 
  I've
  read and seen, this is the expected behaviour but not what I 
  want.

  Is there a way I can get the first invalid field and set the 
  focus to
  that?

  A demo of what I have built up so far can be seen at
 https://webdev2.otago.ac.nz/oihrn2009/

  All my jquery validation can be found in
 https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


  1   2   >