[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-12 Thread Scott
my bad. I misunderstood your question. Ignore my response

On Jan 11, 4:16 pm, Scott counterstre...@gmail.com wrote:
 you could submit the entire form using request.

 $(formid).request({ method: 'post',
   onComplete:function(request){
     alert(request.responseText);
   }

 });

 On Jan 11, 12:11 am, Hussein B hubaghd...@gmail.com wrote:



  Hey,
  I have a checkbox in front of each row in my table.
  Upon clicking on submit button, I want to collect the checked boxes
  and send values via Ajax request.
  How to iterate over the checked boxes?
  Thanks for help and time.
-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-11 Thread Hussein B
Thanks, it works for me.
I have one further question:
As I said, there is a checkbox at the end of each row.
Now I know how to now if the checkbox is checked or not.
What I want to do is if the checkbox is checked, I want to get the
value of the second cell in the table.

ID | NAME | DATE | STATUS | CHECKBOX

How to do this?
Sorry but I'm a client side developer usually, but I have this task to
done.
Thanks again.

On Jan 11, 1:38 pm, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 I use something like this ..
 var array=new Array();
 $$('.myClassName').each(function(e){

 if(($e).checked==true) {
 array.push($(e).value);

 }
 });

 where

 input type=checkbox class=myClassName value=I am checked /

 HTH

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: Hussein B hubaghd...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Monday, January 11, 2010 8:11 AM
 Subject: [Proto-Scripty] Collecting checked checkboxes

  Hey,
  I have a checkbox in front of each row in my table.
  Upon clicking on submit button, I want to collect the checked boxes
  and send values via Ajax request.
  How to iterate over the checked boxes?
  Thanks for help and time.

 --- 
 -



  --
  You received this message because you are subscribed to the Google Groups
  Prototype  script.aculo.us group.
  To post to this group, send email to
  prototype-scriptacul...@googlegroups.com.
  To unsubscribe from this group, send email to
  prototype-scriptaculous+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/prototype-scriptaculous?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-11 Thread joe t.
Couldn't this also work (tweak to fit)?:

var values = $('containerID').select('input:checked[type=checkbox]
[name=checkGroup[]]').pluck('value');

i use that line for radio groups. Got it from:
http://stereointeractive.com/blog/2008/06/05/get-radio-button-value-using-prototype/
-joe t.


On Jan 11, 6:38 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 I use something like this ..
 var array=new Array();
 $$('.myClassName').each(function(e){

 if(($e).checked==true) {
 array.push($(e).value);

 }
 });

 where

 input type=checkbox class=myClassName value=I am checked /

 HTH

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: Hussein B hubaghd...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Monday, January 11, 2010 8:11 AM
 Subject: [Proto-Scripty] Collecting checked checkboxes

  Hey,
  I have a checkbox in front of each row in my table.
  Upon clicking on submit button, I want to collect the checked boxes
  and send values via Ajax request.
  How to iterate over the checked boxes?
  Thanks for help and time.

 

  --
  You received this message because you are subscribed to the Google Groups
  Prototype  script.aculo.us group.
  To post to this group, send email to
  prototype-scriptacul...@googlegroups.com.
  To unsubscribe from this group, send email to
  prototype-scriptaculous+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/prototype-scriptaculous?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-11 Thread Scott
you could submit the entire form using request.

$(formid).request({ method: 'post',
  onComplete:function(request){
alert(request.responseText);
  }
});

On Jan 11, 12:11 am, Hussein B hubaghd...@gmail.com wrote:
 Hey,
 I have a checkbox in front of each row in my table.
 Upon clicking on submit button, I want to collect the checked boxes
 and send values via Ajax request.
 How to iterate over the checked boxes?
 Thanks for help and time.
-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-11 Thread joe t.
Er, a boo-boo on my part when compared to the source... He uses $$()
to directly select the checkboxes, rather than starting at the parent
container and using select(). i imagine it would work either way, but
the original $$() is one step more direct.
-joe t.


On Jan 11, 7:36 pm, joe t. thooke...@gmail.com wrote:
 Couldn't this also work (tweak to fit)?:

 var values = $('containerID').select('input:checked[type=checkbox]
 [name=checkGroup[]]').pluck('value');

 i use that line for radio groups. Got it 
 from:http://stereointeractive.com/blog/2008/06/05/get-radio-button-value-u...
 -joe t.

 On Jan 11, 6:38 am, Alex McAuley webmas...@thecarmarketplace.com
 wrote:

  I use something like this ..
  var array=new Array();
  $$('.myClassName').each(function(e){

  if(($e).checked==true) {
  array.push($(e).value);

  }
  });

  where

  input type=checkbox class=myClassName value=I am checked /

  HTH

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: Hussein B hubaghd...@gmail.com
  To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
  Sent: Monday, January 11, 2010 8:11 AM
  Subject: [Proto-Scripty] Collecting checked checkboxes

   Hey,
   I have a checkbox in front of each row in my table.
   Upon clicking on submit button, I want to collect the checked boxes
   and send values via Ajax request.
   How to iterate over the checked boxes?
   Thanks for help and time.

  

   --
   You received this message because you are subscribed to the Google Groups
   Prototype  script.aculo.us group.
   To post to this group, send email to
   prototype-scriptacul...@googlegroups.com.
   To unsubscribe from this group, send email to
   prototype-scriptaculous+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/prototype-scriptaculous?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-11 Thread joe t.
Ah, a little more tricky.

Assuming:
tr
tdinput type=checkbox name=groupName[]//td
tdCell 1/td
tdCell 2/td
tdCell 3/td
/tr

-SCRIPT-
var values = [];
$$('input:checked[type=checkbox][name=groupName[]]').each(
  function(el){
value.push(el.up().next(1).nodes[0]);
  }
);

i don't really know if Prototype provides a clean Get the text
content of this element method, since IE likes innerText and Firefox
(i think) doesn't. This sample just assumes that the first node of the
second cell with content is text (remember, index 0 when DOM
navigating, so next(1) moves two cells).
-joe t.



On Jan 11, 8:03 am, Hussein B hubaghd...@gmail.com wrote:
 Thanks, it works for me.
 I have one further question:
 As I said, there is a checkbox at the end of each row.
 Now I know how to now if the checkbox is checked or not.
 What I want to do is if the checkbox is checked, I want to get the
 value of the second cell in the table.

 ID | NAME | DATE | STATUS | CHECKBOX

 How to do this?
 Sorry but I'm a client side developer usually, but I have this task to
 done.
 Thanks again.

 On Jan 11, 1:38 pm, Alex McAuley webmas...@thecarmarketplace.com
 wrote:

  I use something like this ..
  var array=new Array();
  $$('.myClassName').each(function(e){

  if(($e).checked==true) {
  array.push($(e).value);

  }
  });

  where

  input type=checkbox class=myClassName value=I am checked /

  HTH

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: Hussein B hubaghd...@gmail.com
  To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
  Sent: Monday, January 11, 2010 8:11 AM
  Subject: [Proto-Scripty] Collecting checked checkboxes

   Hey,
   I have a checkbox in front of each row in my table.
   Upon clicking on submit button, I want to collect the checked boxes
   and send values via Ajax request.
   How to iterate over the checked boxes?
   Thanks for help and time.

  --- 
  -

   --
   You received this message because you are subscribed to the Google Groups
   Prototype  script.aculo.us group.
   To post to this group, send email to
   prototype-scriptacul...@googlegroups.com.
   To unsubscribe from this group, send email to
   prototype-scriptaculous+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/prototype-scriptaculous?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Collecting checked checkboxes

2010-01-11 Thread Al C
Take a look at either

1. getInputs()... (http://www.prototypejs.org/api/form/getInputs)
or
2 . the $$ construct... http://www.prototypejs.org/api/utility/dollar-dollar

If you choose the $$ option, it'll be easier if all of the checkboxes
belong to the same class - e.g., class='first_checkbox'
You could do something like
   var checkboxes = $$('first_checkbox');
or
   var checkboxes = $$('input:[type=checkbox]'); // if they're not
all the same class

then
checkboxes.each( function(s){
//build the query string for your Ajax request
});

On Jan 11, 3:11 am, Hussein B hubaghd...@gmail.com wrote:
 Hey,
 I have a checkbox in front of each row in my table.
 Upon clicking on submit button, I want to collect the checked boxes
 and send values via Ajax request.
 How to iterate over the checked boxes?
 Thanks for help and time.
-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.