[jQuery] Code simplifying request.

2007-03-21 Thread Luc Pestille
Hi all,
I've got some simple validation to do (not enough to use one of the form
plugins), and have this;
 
// when the form is submitted
  $('form#checkout').submit( function(){
  
   // if field has something in it, do submit actions, otherwise write
out error
   if( $('input#rxt_forename').val() == '' ){
// add class to change colour
$('input#rxt_forename').addClass(required).get(0).focus();
$('input#rxt_forename').siblings(span.error).show();
return false;
   }else{
$('input#rxt_forename').removeClass(required);
$('input#rxt_forename').siblings(span.error).hide();
   }
 
How can i simplify it? I would have thought replacing the input selector
with $(this) would work, but it doesn't, and I'm sure the class/siblings
processes could be chained...
 
Thanks,
 
 
Luc Pestille
Web Designer 

e: [EMAIL PROTECTED]
t: +44 (0)1628 899 700
f: +44 (0)1628 899 701 

In2
Thames House
Mere Park
Dedmere Road
Marlow
Bucks
SL7 1PB

Tel 01628 899700
Fax 01628 899701
e: [EMAIL PROTECTED]
i: www.in2.co.uk

This message (and any associated files) is intended only for the use of 
discuss@jquery.com and may contain information that is confidential, subject to 
copyright or constitutes a trade secret. If you are not discuss@jquery.com you 
are hereby notified that any dissemination, copying or distribution of this 
message, or files associated with this message, is strictly prohibited. If you 
have received this message in error, please notify us immediately by replying 
to the message and deleting it from your computer. Messages sent to and from us 
may be monitored. Any views or opinions presented are solely those of the 
author [EMAIL PROTECTED] and do not necessarily represent those of the company.


in2-logo-small.gif
Description: in2-logo-small.gif
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Ajax POST removing spaces from inputs

2007-03-13 Thread Luc Pestille
HI all,
I've run into a problem that I haven't seen before - on a very simple
$.ajax{} powered form using POST, when the string pairs are passed to my
processing page, somewhere along the line any spaces are being stripped
out of the values. An alert(dataString); before the $.ajax{} call shows
that the spaces exist, but when it's submitted to the processing page
the strings have no spaces in them. Do I have to urlencode/decode the
strings somewhere, or is something else messing things up? Anyone come
across this before? 
 
Thanks,
 
Luc Pestille
Web Designer 

e: [EMAIL PROTECTED]
t: +44 (0)1628 899 700
f: +44 (0)1628 899 701 

In2
Thames House
Mere Park
Dedmere Road
Marlow
Bucks
SL7 1PB

Tel 01628 899700
Fax 01628 899701
e: [EMAIL PROTECTED]
i: www.in2.co.uk

This message (and any associated files) is intended only for the use of 
discuss@jquery.com and may contain information that is confidential, subject to 
copyright or constitutes a trade secret. If you are not discuss@jquery.com you 
are hereby notified that any dissemination, copying or distribution of this 
message, or files associated with this message, is strictly prohibited. If you 
have received this message in error, please notify us immediately by replying 
to the message and deleting it from your computer. Messages sent to and from us 
may be monitored. Any views or opinions presented are solely those of the 
author [EMAIL PROTECTED] and do not necessarily represent those of the company.


in2-logo-small.gif
Description: in2-logo-small.gif
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Checking select option has class?

2006-10-19 Thread Luc Pestille
Hi all,
:disabled doesn't want to work as I expect - when I submit with a
disabled option selected, the whole select drop down becomes disabled
(or rather the class is added to ALL the options). I've added my real
code in below, rather than working with hypotheticals - any more ideas?


// if option is disabled, don't submit it
if( $('#idol_date_day1').is(:checked)  $('#idol_datetime_day1
option:disabled') ){
// add class to change colour
$('#idol_datetime_day1
option:disabled').addClass(required).get(0).focus();
return false;
}else{
$('#idol_datetime_day1
option:disabled').removeClass(required);
}

Thanks,

Luc


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Dave Methvin
Sent: 18 October 2006 17:54
To: 'jQuery Discussion.'
Subject: Re: [jQuery] Checking select option has class?

 
 $('#myselect option').is(:disabled).addClass('disabled');

.is() isn't chainable, but you can just add :disabled to the selector:

$('#myselect option:disabled').addClass('disabled');


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/ 

In2
Thames House
Mere Park
Dedmere Road
Marlow
Bucks
SL7 1PB

Tel 01628 899700
Fax 01628 899701
e: [EMAIL PROTECTED]
i: www.in2.co.uk

This message (and any associated files) is intended only for the use of 
discuss@jquery.com and may contain information that is confidential, subject to 
copyright or constitutes a trade secret. If you are not discuss@jquery.com you 
are hereby notified that any dissemination, copying or distribution of this 
message, or files associated with this message, is strictly prohibited. If you 
have received this message in error, please notify us immediately by replying 
to the message and deleting it from your computer. Messages sent to and from us 
may be monitored. Any views or opinions presented are solely those of the 
author [EMAIL PROTECTED] and do not necessarily represent those of the company.

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Checking select option has class?

2006-10-18 Thread Luc Pestille










Hi 
all,
Thanks to 
IE's wonderful ommission of disabled="disabled" for options in select drop 
downs, I need to add a class to disabled options and and check for that class 
when the form is submitted. How doI check the selected option has a class 
within a select? 

if($('#myselect').get(0).hasClass("disabled") 
){
 //don't submit the 
form
}

???
TIA.



  
  



  Luc PestilleWeb Designer 
  e: [EMAIL PROTECTED]t: +44 (0)1628 899 700f: +44 (0)1628 
  899 701 






In2Thames HouseMere ParkDedmere RoadMarlowBucksSL7 1PBTel 01628 899700Fax 01628 899701e: [EMAIL PROTECTED]i: www.in2.co.ukThis message (and any associated files) is intended only for the use of discuss@jquery.com and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not discuss@jquery.com you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored. Any views or opinions presented are solely those of the author [EMAIL PROTECTED] and do not necessarily represent those of the company. 






			___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Checking select option has class?

2006-10-18 Thread Luc Pestille



Nope, that didn't work - I suspect (read:complete 
guess)because #myselect is the select element itself, not the option 
within it. Anyone else offer a solution?


if($('#myselect').is(":disabled") 
){
 //don't submit 
the form
}



From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Sam 
CollettSent: 18 October 2006 17:07To: jQuery 
Discussion.Subject: Re: [jQuery] Checking select option has 
class?
On 18/10/06, Luc Pestille [EMAIL PROTECTED] wrote:


  
  
  


  
  
Hi all,
Thanks to IE's wonderful 
ommission of disabled="disabled" for options in select drop downs, I 
need to add a class to disabled options and and check for that class 
when the form is submitted. How doI check the selected option has 
a class within a select? 

if($('#myselect').get(0).hasClass("disabled") 
){
 //don't 
submit the form
}

???
TIA.



  
  



  Luc PestilleWeb Designer 
  e: [EMAIL PROTECTED]t: +44 (0)1628 899 
  700f: +44 (0)1628 899 701 


  

  
In2Thames HouseMere ParkDedmere 
RoadMarlowBucksSL7 1PBTel 01628 899700Fax 01628 
899701e: [EMAIL PROTECTED]i: www.in2.co.ukThis message 
(and any associated files) is intended only for the use of discuss@jquery.com 
and may contain information that is confidential, subject to copyright 
or constitutes a trade secret. If you are not discuss@jquery.com 
you are hereby notified that any dissemination, copying or distribution 
of this message, or files associated with this message, is strictly 
prohibited. If you have received this message in error, please notify us 
immediately by replying to the message and deleting it from your 
computer. Messages sent to and from us may be monitored. Any views or 
opinions presented are solely those of the author [EMAIL PROTECTED] and do not necessarily 
represent those of the company. 
  ___jQuery 
  mailing listdiscuss@jquery.comhttp://jquery.com/discuss/I 
think this should work:
if($('#myselect').is(":disabled") 
){
 //don't submit 
the form
}
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/