[jQuery] unsub

2008-04-14 Thread Can Filibeli



[jQuery] Nicejforms with 2 forms

2008-04-14 Thread Alexandre Boca
Hi,

I would like to use the plugin nicejforms (http://www.lexcat.ro/nicejforms/),
this one works with only 1 form on the page.

But i want to use it with several forms on the page, how can i fix it?

An example with 2 forms = http://www.hybridbears.com/nicejforms/

thanks

-- 
Alexandre BOCA
[EMAIL PROTECTED]


[jQuery] Expression for finding a displayed DIV?

2008-04-14 Thread [EMAIL PROTECTED]

Hi,

I have a number of DIVS of class = policy on my page.  At any one
time, only one will be displayed, that is, have the CSS display
attribute set to block.  How can I write a JQuery expression to find
the ID of such a DIV?

Thanks, - Dave


[jQuery] Re: Expression for finding a displayed DIV?

2008-04-14 Thread Jake McGraw

var id = $(div.policy:visible).attr(id);

- jake

On Mon, Apr 14, 2008 at 11:57 AM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

  Hi,

  I have a number of DIVS of class = policy on my page.  At any one
  time, only one will be displayed, that is, have the CSS display
  attribute set to block.  How can I write a JQuery expression to find
  the ID of such a DIV?

  Thanks, - Dave



[jQuery] Getting URL hash

2008-04-14 Thread [EMAIL PROTECTED]

Hi,

Not sure if this is the right terminology, but what is the JQuery way
to detect if, and then store in a variable, the URL's hash value,
meaning anything coming after the #?

Thanks, - Dave


[jQuery] Re: Getting URL hash

2008-04-14 Thread Scott Trudeau
Not sure if there's a jQuery way ... this:

var hashAnchor = self.document.location.hash.substring(1);


Has worked for me...

Scott

On Mon, Apr 14, 2008 at 12:48 PM, [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote:


 Hi,

 Not sure if this is the right terminology, but what is the JQuery way
 to detect if, and then store in a variable, the URL's hash value,
 meaning anything coming after the #?

 Thanks, - Dave




-- 
--
Scott Trudeau
scott.trudeau AT gmail DOT com
http://sstrudeau.com/
AIM: sodthestreets


[jQuery] Re: Star Rating Plugin v2.2: Problem disabling cancel button

2008-04-14 Thread DragonI

Cool - thanks kadda!

On Apr 12, 4:06 pm, kadda [EMAIL PROTECTED] wrote:
 On Apr 11, 3:35 am, DragonI [EMAIL PROTECTED] wrote:



  Hi,

  I'm having a problem disabling the cancel button. Maybe it's just
  me ;)

  code says: //required: false, // disables the 'cancel' button so user
  can only select one of the specified values

  Here's what I tried:

  form id=form1
  input class=star{required:false} type=radio name=test-1-
 rating-2 value=1 title=Worst/
  input class=star{required:false} type=radio name=test-1-
 rating-2 value=2 title=Bad/
  input class=star{required:false} type=radio name=test-1-
 rating-2 value=3 title=Good/
  input class=star{required:false} type=radio name=test-1-
 rating-2 value=4 title=Excellent/
  /form

  Also tried:

  $(function(){ $
  ('[EMAIL PROTECTED]').rating({required:false}); });

  Thanks

 I have the same problem, i fixed by just altering the js code on line
 112. Replacing the if statement with a if(true) which will always be
 true. But I want to know how this can be fixed in html if I want to
 display more than oneratingon the same page using the same js file.

/*if($.rating.groups[n].readOnly || settings.required){*/
if(true){
 // DO NOT display 'cancel' button
}
else{
 // Display 'cancel' button
 $(this).before(
  $('div class=cancela title=' + settings.cancel + '' +
 settings.cancelValue + '/a/div')
  .mouseover(function(){ $.rating.event.drain(n, this, settings); $
 (this).addClass('star_on'); })
  .mouseout(function(){ $.rating.event.reset(n, this, settings); $
 (this).removeClass('star_on'); })
  .click(function(){ $.rating.event.click(n, this, settings); })
 );
}


[jQuery] Re: Autocomplete and JSON

2008-04-14 Thread dineshv

Say, there are 10,000 items in a server database and we set MAX=100.
Assume the user entry Q=the results in 250 entries.  The server
sends all 250 entries to the browser but Autocomplete (AC) will only
use the first MAX=100 entries.  The 100 entries are displayed in a
scroll bar.

If the user scrolls all the way down to item 100 and beyond, AC will
circle back to item 1.  Can AC be setup so that when the user scrolls
beyond item 100 it will go and fetch items 101 to 200 (or some number
 100)?

In other words, if the user wants to see all database entries with
Q=the and the number of entries is  MAX, how can this be done?

Dinesh


On Apr 9, 11:20 pm, dineshv [EMAIL PROTECTED] wrote:
 Actually, you don't need the simplejson at the server.  This works:

 def GET(self):
  result = 
  for item in data:
  print item

 On Apr 9, 1:36 pm, dineshv [EMAIL PROTECTED] wrote:

  Hi Ashley

  I'll work through your code but sending each item one at a time from
  the server will also work.  It is working for me right now ie.

  def GET(self):
  result = 
  for item in data:
  result = simplejson.dumps(item)
  print result

 Dinesh

  On Apr 8, 10:58 am, Ashley Pond V [EMAIL PROTECTED] wrote:

   On Apr 8, 2008, at 10:53 AM, dineshv wrote:

Okay, I sorted out the previous problem and can get data from the
Python backend to the browser via the Autocomplete plugin.  But, the
test data:

data = [string 1, string 2, string 3, string 4, string 5]

... displays as one string item ie.:

[string 1, string 2, string 3, string 4, string 5]

... including the square brackets!  ... instead of one string per line
ie.:

   I explained how to do this in my previous message. You have to do the
   overrides if you want to do anything but 1/line plain text.

   -Ashley


[jQuery] get scrollTop of an iframe

2008-04-14 Thread [EMAIL PROTECTED]

I have an iframe in my page, and I need to get the scrollTop, or the
amount the iframe is scrolled vertically, but the Dimensions plugin,
and everything else I've found, just don't work. This script needs to
be on my site, then when the iframe is scrolled I need to know how far
it was scrolled.

Any ideas?


[jQuery] Re: Autocomplete and JSON

2008-04-14 Thread Jörn Zaefferer


dineshv schrieb:

Say, there are 10,000 items in a server database and we set MAX=100.
Assume the user entry Q=the results in 250 entries.  The server
sends all 250 entries to the browser but Autocomplete (AC) will only
use the first MAX=100 entries.  The 100 entries are displayed in a
scroll bar.

If the user scrolls all the way down to item 100 and beyond, AC will
circle back to item 1.  Can AC be setup so that when the user scrolls
beyond item 100 it will go and fetch items 101 to 200 (or some number  100)?
  


In other words, if the user wants to see all database entries with
Q=the and the number of entries is  MAX, how can this be done?
  

He has to enter more then the.

Jörn


[jQuery] Re: [Validation]How to make two field check output one message?

2008-04-14 Thread Jörn Zaefferer


Jacky schrieb:

I'm thinking if I can do this:

rules:{
planFromDate: {dateRange:'plan'}, planToDate: {dateRange:'plan'}
actualFromDate: {dateRange:'actual'}, actualToDate: 
{dateRange:'actual'}

}
groups: {
dateRange: planFromDate planToDate actualFromDate actualToDate
}

$.validator.addMethod('dateRange',function(value,elem,param){
var f = $(elem).parents(form:eq(0))[0];
from = f[param+'FromDate'].value;
to = f[param+'ToDate'].value;
if(!from || !to ||
/Invalid|NaN/.test(new Date(from)) || 
/Invalid|NaN/.test(new Date(to)))

return true;
return from  to  new Date(from)  new Date(to);
},'wrong date range');

Give this a try:

rules:{
   planFromDate: {dateRange:'plan'}, planToDate: {dateRange:'plan'}
   actualFromDate: {dateRange:'actual'}, actualToDate: {dateRange:'actual'}
}
groups: {
   plan: planFromDate planToDate,
   actual: actualFromDate actualToDate
}

$.validator.addMethod('dateRange',function(value,elem,param){
   var f = elem.form;
   var from = f[param+'FromDate'].value;
   var to = f[param+'ToDate'].value;
   if(!from || !to ||
   /Invalid|NaN/.test(new Date(from)) || 
   /Invalid|NaN/.test(new Date(to)))

   return true;
   return from  to  new Date(from)  new Date(to);
},'wrong date range');

Jörn


[jQuery] Pairing Toggle/Expand Behavior with Particular Element Pairs

2008-04-14 Thread Brian Talbot

Hi All,

I was wondering if anyone had any insight into an issue I'm having
when using JQuery to show/hide a series of elements on a page. I
currently have a set of comments (to be placed in a larger page) and
along with each comment a form is needed to allow users to flag an
individual comment.

I've tried to create this page with accessibility in mind so there is
one unique form (with its own ID) for each comment  (also with its own
ID). You can view a sample page without any styling here -
http://brian-talbot.com/inventingroom/flagcomments/

The interaction I'd like to have is when a user clicks on the Flag
This Comment link (that I am inserting into each comment's div
using JQuery) The form for the specific comment the user wants to flag
(hidden by default using JQuery) toggles its visibility to visible and
allows the user to enter information.

What I have now doesn't account for the specific comment a user
selects and expands all of the comments instead :o( Also, I'd love to
be able to do the following:

1) Change the text of the Flag This Comment toggle link to display
something else once the form is expanded for a particular comment -
perhaps to something like Cancel Flagging This Comment.

2) Dynamically add an href attribute to the Flag This Comment toggle
link that provides an anchor link down to the corresponding flag form
(i.e. a class=button button-flag flag-toggle href=#flag-
comment001spanFlag This Comment/span/a

If anyone has any ideas and wouldn't mind sharing, it would be much
appreciated. Thanks!


[jQuery] Selecting a specific number of children rather than number of specific elements

2008-04-14 Thread Brian Talbot

Hi All,

I was wondering if someone could help refine a content toggling
solution that I have now. As of now, the demo page below takes the
first 3 p elements within a parent div with a specific ID and
hides the remainder of the paragraphs in this parent div by placing
them in a newly created div and then creating an a element that
toggles the visibility of this new div container.

http://brian-talbot.com/inventingroom/jquery-expand/

I'd like to be able to include other elements besides p within the
original parent div and have JQuery count and display the first
three child elements (regardless of what they are) of the parent div
and hide the remainder as it does now. Does anyone have any advice on
how to think about or execute this?

Please note: the demo above contains other elements aside from p
elements to demonstrate the current limitations of what I have now.

Thanks for your help as always.



[jQuery] Re: Getting URL hash

2008-04-14 Thread Ariel Flesler

just location.hash.slice(1);

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

On 14 abr, 14:01, Scott Trudeau [EMAIL PROTECTED] wrote:
 Not sure if there's a jQuery way ... this:

 var hashAnchor = self.document.location.hash.substring(1);

 Has worked for me...

 Scott

 On Mon, Apr 14, 2008 at 12:48 PM, [EMAIL PROTECTED] 

 [EMAIL PROTECTED] wrote:

  Hi,

  Not sure if this is the right terminology, but what is the JQuery way
  to detect if, and then store in a variable, the URL's hash value,
  meaning anything coming after the #?

  Thanks, - Dave

 --
 --
 Scott Trudeau
 scott.trudeau AT gmail DOT comhttp://sstrudeau.com/
 AIM: sodthestreets


[jQuery] Error Handling

2008-04-14 Thread cfdvlpr

I'd like to know when a Javascript error occurs, and I'd like to be
sent an email when this happens.   I'm not sure if or how jQuery can
help here, but I have a feeling that it can. I can write the server
side script to email the error, that's not a problem.  But, I'm not
sure how to capture the Javascript error message and send it to the
script that emails the error.  Here's something untested that I was
thinking might be a good start.  I'm wondering if anyone else has
coded something like this and would give me some pointers.

script type=text/javascript
$(function() {
   window.onerror=emailError;
});
function emailerror(){
   $.get(/emailError.cfm, { errorMessage:
notSureWhatVariabletoPassinHere });
}
/script


[jQuery] problem with POST through ajax

2008-04-14 Thread Equand

Hi guys, i don't understand if it is a problem on my server or with
ajax at all
I'm sending POST data to server through ajax in jquery but the server
reports no data received (php $_POST['data'] is empty). However it
occurs only when the size of the data is over 50kb or so...
what can it be?


[jQuery] Re: problem with POST through ajax

2008-04-14 Thread Equand

sorry fixed this - damn suhosin :(

On Apr 15, 12:58 am, Equand [EMAIL PROTECTED] wrote:
 Hi guys, i don't understand if it is a problem on my server or with
 ajax at all
 I'm sending POST data to server through ajax in jquery but the server
 reports no data received (php $_POST['data'] is empty). However it
 occurs only when the size of the data is over 50kb or so...
 what can it be?


[jQuery] Setting option to selected

2008-04-14 Thread Rey Bango


Guys,

I wanted to set an option in a select element to selected. The options 
are being created on the fly. The rules are simple. If there's more than 
one option, then set the second option to selected. Otherwise, set the 
first option to selected. I tried to use a ternary operator but it failed:


$(select#cert_id option:eq((i  1?1:0))).attr( selected, selected );


If I use the code below, it works:

if (i  1) {
$(select#cert_id option:eq(1)).attr( selected, selected );
}
else {
$(select#cert_id option:eq(0)).attr( selected, selected );
}

Could someone give me some insight as to why the ternary expression 
option failed?


Thanks,

Rey


[jQuery] Re: Setting option to selected

2008-04-14 Thread Karl Rudd

As far as I know you can't use anything but a simple number with the
:eq() selector.

You could rewrite the code as:

$( select#cert_id option:eq( + (i  1?1:0) +  ) ).attr(
selected, true );

Note how the ternary operator is outside the selector string, it's
just used to produce a 1 or a 0, which is then merged into the
selector string.

Karl Rudd

On Tue, Apr 15, 2008 at 10:32 AM, Rey Bango [EMAIL PROTECTED] wrote:

  Guys,

  I wanted to set an option in a select element to selected. The options
 are being created on the fly. The rules are simple. If there's more than one
 option, then set the second option to selected. Otherwise, set the first
 option to selected. I tried to use a ternary operator but it failed:

  $(select#cert_id option:eq((i  1?1:0))).attr( selected, selected );


  If I use the code below, it works:

  if (i  1) {
 $(select#cert_id option:eq(1)).attr( selected, selected );
  }
  else {
 $(select#cert_id option:eq(0)).attr( selected, selected );
 }

  Could someone give me some insight as to why the ternary expression option
 failed?

  Thanks,

  Rey



[jQuery] Re: Focus First 'visible' field

2008-04-14 Thread MichaelEvangelista

I've been looking for a solution like this, but that will work with
any type of form input.
The code I've been using is below (where form-id is the ID of the
containing form)

It works great in Firefox but IE throws the error
'this.parentNode.borderCss.on' is null or not an object

I tried your example code above, and got the same error

here is what I was using :

// --- Put the cursor in the first field on page load
var $firstfield = function(){
$('#form-id input:eq(0)').focus();
}
$firstfield();

Could this have anything to do with my markup? I didnt get that error
on your demo, but i did when I applied your code to my form.



On Apr 13, 7:54 am, Jacky  See [EMAIL PROTECTED] wrote:
 Hi all,

 For focusing first input text field, the usual solution is $
 (':text:visible:enabled:eq(0)').focus(). However, when these fields
 are in an ':hidden' parent (not 'visible' by our eyes), it won't work.

 Currently I tried to solve this by:

 $(:text:visible:enabled).filter(function(){
 return $(this).parents(:hidden).size()==0;

 }).slice(0,1).focus();

 I have setup a test page for this:http://www.seezone.net/dev/focusField.html
 Try to toggle different parent to and click 'focus'. It should work
 correctly.

 I would like to know if there is any other 'selector-based' way to do
 so?


[jQuery] Re: Selecting a specific number of children rather than number of specific elements

2008-04-14 Thread Karl Rudd

Instead of:

$( '#article p' )

You can use:

$( '#article  *' )

Which will get all the immediate children (but not grandchildren) of
#article. Append :gt() and :eq() to your hearts content.

Karl Rudd

On Tue, Apr 15, 2008 at 8:00 AM, Brian Talbot [EMAIL PROTECTED] wrote:

  Hi All,

  I was wondering if someone could help refine a content toggling
  solution that I have now. As of now, the demo page below takes the
  first 3 p elements within a parent div with a specific ID and
  hides the remainder of the paragraphs in this parent div by placing
  them in a newly created div and then creating an a element that
  toggles the visibility of this new div container.

  http://brian-talbot.com/inventingroom/jquery-expand/

  I'd like to be able to include other elements besides p within the
  original parent div and have JQuery count and display the first
  three child elements (regardless of what they are) of the parent div
  and hide the remainder as it does now. Does anyone have any advice on
  how to think about or execute this?

  Please note: the demo above contains other elements aside from p
  elements to demonstrate the current limitations of what I have now.

  Thanks for your help as always.




[jQuery] problem with focus() and IE

2008-04-14 Thread MichaelEvangelista

I wrote a simple little bit of code to set focus on the first visible
form element in a form

$('#tab0 table tr :input:visible:first').focus();

It works great in Firefox but IE throws the error

  'this.parentNode.borderCss.on' is null or not an object   

I also tried
$('#tab0 input:eq(0)').focus();
with the same results - works in FF, gives that error in IE

any ideas?a


[jQuery] Re: Setting option to selected

2008-04-14 Thread Rey Bango


That did the trick Karl. Thanks for your help! :D

Rey

Karl Rudd wrote:

As far as I know you can't use anything but a simple number with the
:eq() selector.

You could rewrite the code as:

$( select#cert_id option:eq( + (i  1?1:0) +  ) ).attr(
selected, true );

Note how the ternary operator is outside the selector string, it's
just used to produce a 1 or a 0, which is then merged into the
selector string.

Karl Rudd

On Tue, Apr 15, 2008 at 10:32 AM, Rey Bango [EMAIL PROTECTED] wrote:

 Guys,

 I wanted to set an option in a select element to selected. The options
are being created on the fly. The rules are simple. If there's more than one
option, then set the second option to selected. Otherwise, set the first
option to selected. I tried to use a ternary operator but it failed:

 $(select#cert_id option:eq((i  1?1:0))).attr( selected, selected );


 If I use the code below, it works:

 if (i  1) {
$(select#cert_id option:eq(1)).attr( selected, selected );
 }
 else {
$(select#cert_id option:eq(0)).attr( selected, selected );
}

 Could someone give me some insight as to why the ternary expression option
failed?

 Thanks,

 Rey





[jQuery] Optimize and Improve my code please

2008-04-14 Thread Rey Bango


Guys,

I have a code snippet which I would like to improve and optimize and was 
hoping to get some help. The form has two chained selects so when you 
select an option on the first one, the second gets populated via an Ajax 
call. The code is based off of Remy Sharp's chained select article and 
I've added some code for special situations. Selectbox #1 lists 
available products while selectbox #2 will display certificates 
belonging to the product chosen.


Here are the situations:

1) If product selected has certificates, then second dropdown is 
populated via Ajax call
2) If product selected has no certificates, then second dropdown is made 
invisible
3) If product selected is “All” (which has an empty value), then second 
dropdown is populated with all certificates the same as when the page 
initially loaded


I know this code can be done better and I'm all ears on improving it.

$(function(){

  $(select#prod_id).change(function(){

// Default options
		var defaultOptions = 'option value=All/optionoption 
value=141CCA for Citrix Access Gateway 4/optionoption 
value=142CCA for Citrix Access Gateway 8 Enterprise 
Edition/optionoption value=144CCA for Citrix EdgeSight 
4/optionoption value=143CCA for Citrix NetScaler 8/optionoption 
value=140CCA for Citrix Password Manager 4/optionoption 
value=170CCA for Citrix Provisioning Server 4/optionoption 
value=145CCA for Citrix WANScaler 4/optionoption value=139CCA 
for XenApp (Presentation Server 4)/optionoption value=157CCA for 
XenServer 4/optionoption value=146CCEA for Citrix XenApp 
(Presentation Server 4)/optionoption value=147CCIA for XenApp 
(Presentation Server 4)/optionoption value=148CCSP 2007 
/optionoption value=149CCSP for Citrix Presentation Server 
4/option';


if ($(this).val() == ){
$(select#cert_id).html(defaultOptions);
$( select#cert_id option:eq(0) ).attr(selected, 
true ); 
$(#certification).show();   
}   
else
{
			$.getJSON(/courses/exams/getcerts.cfm?headerescape=true,{id: 
$(this).val()}, function(j){

var options = '';

if (j.length  0){
for (var i = 0; i  j.length; i++) {
		options += 'option value=' + j[i].optionValue + '' + 
j[i].optionDisplay + '/option';

}

$(select#cert_id).html(options);
$( select#cert_id option:eq(0) 
).attr(selected, true ); 
$(#certification).show();
}
else
{
options = 'option value=/option'; 
  
$(select#cert_id).html(options);  
  
$(#certification).hide();
}
});
}
})
})