Re: Q: Java Script Check All The CheckBox?

2011-01-19 Thread Thiago H. de Paula Figueiredo
On Wed, 19 Jan 2011 01:21:02 -0200, penyihirkecil  
penyihirke...@gmail.com wrote:



is there any simple way to do that without having a new component.
I mean it just feel weird.
this simple things should be solve using simple solution.


There is a simple solution. Just writing ordinary JavaScript to do that.  
There's no need to have Tapestry code. Of course, you can write a  
component or mixin to reuse this solution, but it's not obligatory.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Q: Java Script Check All The CheckBox?

2011-01-19 Thread Josh Canfield
You can trim that down even more:

function selectAllCheckboxes(select) {
var checked = $('checkAllRemove').checked;
$('newspaperForm').getInputs('checkbox').each(function(el) {
el.checked = checked;
});
}

Also, I realize this probably isn't your production code, but you should
always wrap the labels for checkboxes and radio buttons in a label
element. This lets you click the text instead of the tiny box...

input t:type=checkbox t:id=yahoo_check value=subscribeYahoo/label
for=yahoo_checkYahoo/label
input t:type=checkbox t:id=google_check value=subscribeGoogle/label
for=google_checkGoogle/label
input type=checkbox id=checkAllRemove
onClick=selectAllCheckboxes();/label
for=checkAllRemoveCheck All/label

Josh


On Tue, Jan 18, 2011 at 11:54 PM, dwi ardi irawan
penyihirke...@gmail.comwrote:

 I agree 
 this is my solution. thnx to josh canfield who give me the idea.

 Instead of using document.getElementsByTagName(INPUT) then check whether
 is checkbox or not, I prefer to use this method. the same idea as josh
 canfield but I try to get the form element as the root of iteration, not
 the
 input. it's to avoid if there is more than one form in one page.

 IHMO(cos I doesn't have enough experiance to make an opinion which one is
 better). what I mean with a simple solution is we try to do this in client
 side. and we don't have to use others component.

 script type=text/javascript language=JavaScript

 function selectAllCheckboxes(select){

 !-- //
 var form = document.getElementById(newspaperForm);
 var checkAll = document.getElementById(checkAllRemove);
 if(checkAll.checked){
 for (var i=0;iform.length;i++)
 {
 if (form.elements[i].type == checkbox) {
 form.elements[i].checked = true;
 }
 }
 }else{
 for (var i=0;iform.length;i++)
 {
 if (form.elements[i].type == checkbox) {
 form.elements[i].checked = false;
 }
 }
 }
 // --
 }
  /script

 form t:type=form t:id=newspaperForm
input t:type=checkbox t:value=subscribeYahoo/Yahoo
input t:type=checkbox t:value=subscribeGoogle/Google
input type=checkbox id=checkAllRemove
 onClick=selectAllCheckboxes();/Check All
 input type=submit value=Submit/br/
Result : b${value}/b
 /form

  I am sorry, I am not very fluently in english. ^^,

 regards,

 dwi ardi irawan

 On Wed, Jan 19, 2011 at 12:16 PM, Taha Hafeez tawus.tapes...@gmail.com
 wrote:

  Yes, this is an option as are others and these can be used AFAIK. The
  thread
  there shows a way to use it even if javascript is disabled
 
  regards
  Taha
 
 --



Q: Java Script Check All The CheckBox?

2011-01-18 Thread dwi ardi irawan
Okay, it might be old question, but I've searched through mailing list
archive, but haven't found the solution yet.

I have 2 checkbox. and I want to create a checkbox master(when I click this
checkbox, all the checkbox will be checked).
I can't use the common js algorithm here, cos I can't get the id of the
checkbox.

CheckBoxPage.tml

this is my simple code:
script type=text/javascript language=JavaScript
function checkAllDetail(){

}
/script
form t:type=form t:id=newspaperForm
input t:type=checkbox t:value=subscribeYahoo/Yahoo
input t:type=checkbox t:value=subscribeGoogle/Google
input type=checkbox id=checkAllRemove
onclick=checkAllDetail()/Check All
input type=submit value=Submit/br/
Result : b${value}/b
/form

CheckBoxPage.java

public class CheckBoxPage {
@Property
private boolean subscribeYahoo;
@Property
private boolean subscribeGoogle;
@Persist(PersistenceConstants.FLASH)
@Property
private String value;

void onSuccessFromNewspaperForm(){
value = ;
if(subscribeYahoo){
value += Yahoo ;
}
if(subscribeGoogle) {
value += Google ;
}
}
}

can anyone help me?

thnx you

dwi ardi irawan


Re: Q: Java Script Check All The CheckBox?

2011-01-18 Thread Josh Canfield
http://tapestry.1045711.n5.nabble.com/Disabled-button-events-are-queued-and-executed-td3341300.html

Here is a thread from yesterday that includes an attachment with a working
example.

Josh

On Tue, Jan 18, 2011 at 10:15 AM, dwi ardi irawan
penyihirke...@gmail.comwrote:

 Okay, it might be old question, but I've searched through mailing list
 archive, but haven't found the solution yet.

 I have 2 checkbox. and I want to create a checkbox master(when I click this
 checkbox, all the checkbox will be checked).
 I can't use the common js algorithm here, cos I can't get the id of the
 checkbox.

 CheckBoxPage.tml

 this is my simple code:
 script type=text/javascript language=JavaScript
function checkAllDetail(){

}
 /script
 form t:type=form t:id=newspaperForm
input t:type=checkbox t:value=subscribeYahoo/Yahoo
input t:type=checkbox t:value=subscribeGoogle/Google
input type=checkbox id=checkAllRemove
 onclick=checkAllDetail()/Check All
input type=submit value=Submit/br/
Result : b${value}/b
 /form

 CheckBoxPage.java

 public class CheckBoxPage {
@Property
private boolean subscribeYahoo;
@Property
private boolean subscribeGoogle;
@Persist(PersistenceConstants.FLASH)
@Property
private String value;

void onSuccessFromNewspaperForm(){
value = ;
if(subscribeYahoo){
value += Yahoo ;
}
if(subscribeGoogle) {
value += Google ;
}
}
 }

 can anyone help me?

 thnx you

 dwi ardi irawan



Re: Q: Java Script Check All The CheckBox?

2011-01-18 Thread Shing Hing Man
Hi,
 I have a written a component and a mixin to form a 'checkbox group'.
If you are interested, there is online demo at 
http://lombok.demon.co.uk/tapestry5Demo/test/components/checkboxgroupdemo

Source code download instruction is on  
http://lombok.demon.co.uk/tapestry5Demo/

Shing 



--- On Wed, 19/1/11, dwi ardi irawan penyihirke...@gmail.com wrote:

 From: dwi ardi irawan penyihirke...@gmail.com
 Subject: Q: Java Script Check All The CheckBox?
 To: users@tapestry.apache.org
 Date: Wednesday, 19 January, 2011, 2:15
 Okay, it might be old question, but
 I've searched through mailing list
 archive, but haven't found the solution yet.
 
 I have 2 checkbox. and I want to create a checkbox
 master(when I click this
 checkbox, all the checkbox will be checked).
 I can't use the common js algorithm here, cos I can't get
 the id of the
 checkbox.
 
 CheckBoxPage.tml
 
 this is my simple code:
 script type=text/javascript
 language=JavaScript
         function checkAllDetail(){
 
         }
 /script
 form t:type=form t:id=newspaperForm
     input t:type=checkbox
 t:value=subscribeYahoo/Yahoo
     input t:type=checkbox
 t:value=subscribeGoogle/Google
     input type=checkbox
 id=checkAllRemove
 onclick=checkAllDetail()/Check All
     input type=submit
 value=Submit/br/
     Result : b${value}/b
 /form
 
 CheckBoxPage.java
 
 public class CheckBoxPage {
     @Property
     private boolean subscribeYahoo;
     @Property
     private boolean subscribeGoogle;
     @Persist(PersistenceConstants.FLASH)
     @Property
     private String value;
 
     void onSuccessFromNewspaperForm(){
         value = ;
         if(subscribeYahoo){
             value += Yahoo
 ;
         }
         if(subscribeGoogle) {
             value += Google
 ;
         }
     }
 }
 
 can anyone help me?
 
 thnx you
 
 dwi ardi irawan
 




-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Q: Java Script Check All The CheckBox?

2011-01-18 Thread penyihirkecil

is there any simple way to do that without having a new component.
I mean it just feel weird.
this simple things should be solve using simple solution.

the zip file from this thread:
http://tapestry.1045711.n5.nabble.com/Disabled-button-events-are-queued-and-executed-td3341300.html

it's weird, getting the checkbox using 
document.getElementsByTagName(INPUT) and check it whether it checkbox 
or not.


it just my opinion,

dwi ardi irawan


On 19/01/2011 2:18, Shing Hing Man wrote:

Hi,
  I have a written a component and a mixin to form a 'checkbox group'.
If you are interested, there is online demo at
http://lombok.demon.co.uk/tapestry5Demo/test/components/checkboxgroupdemo

Source code download instruction is on
http://lombok.demon.co.uk/tapestry5Demo/

Shing



--- On Wed, 19/1/11, dwi ardi irawanpenyihirke...@gmail.com  wrote:


From: dwi ardi irawanpenyihirke...@gmail.com
Subject: Q: Java Script Check All The CheckBox?
To: users@tapestry.apache.org
Date: Wednesday, 19 January, 2011, 2:15
Okay, it might be old question, but
I've searched through mailing list
archive, but haven't found the solution yet.

I have 2 checkbox. and I want to create a checkbox
master(when I click this
checkbox, all the checkbox will be checked).
I can't use the common js algorithm here, cos I can't get
the id of the
checkbox.

CheckBoxPage.tml

this is my simple code:
script type=text/javascript
language=JavaScript
 function checkAllDetail(){

 }
/script
form t:type=form t:id=newspaperForm
 input t:type=checkbox
t:value=subscribeYahoo/Yahoo
 input t:type=checkbox
t:value=subscribeGoogle/Google
 input type=checkbox
id=checkAllRemove
onclick=checkAllDetail()/Check All
 input type=submit
value=Submit/br/
 Result :b${value}/b
/form

CheckBoxPage.java

public class CheckBoxPage {
 @Property
 private boolean subscribeYahoo;
 @Property
 private boolean subscribeGoogle;
 @Persist(PersistenceConstants.FLASH)
 @Property
 private String value;

 void onSuccessFromNewspaperForm(){
 value = ;
 if(subscribeYahoo){
 value += Yahoo
;
 }
 if(subscribeGoogle) {
 value += Google
;
 }
 }
}

can anyone help me?

thnx you

dwi ardi irawan





-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Q: Java Script Check All The CheckBox?

2011-01-18 Thread Josh Canfield
Please describe a simple solution.

On Tue, Jan 18, 2011 at 7:21 PM, penyihirkecil penyihirke...@gmail.comwrote:

 is there any simple way to do that without having a new component.
 I mean it just feel weird.
 this simple things should be solve using simple solution.

 the zip file from this thread:


 http://tapestry.1045711.n5.nabble.com/Disabled-button-events-are-queued-and-executed-td3341300.html

 it's weird, getting the checkbox using
 document.getElementsByTagName(INPUT) and check it whether it checkbox or
 not.

 it just my opinion,

 dwi ardi irawan



 On 19/01/2011 2:18, Shing Hing Man wrote:

 Hi,
  I have a written a component and a mixin to form a 'checkbox group'.
 If you are interested, there is online demo at
 http://lombok.demon.co.uk/tapestry5Demo/test/components/checkboxgroupdemo

 Source code download instruction is on
 http://lombok.demon.co.uk/tapestry5Demo/

 Shing



 --- On Wed, 19/1/11, dwi ardi irawanpenyihirke...@gmail.com  wrote:

  From: dwi ardi irawanpenyihirke...@gmail.com
 Subject: Q: Java Script Check All The CheckBox?
 To: users@tapestry.apache.org
 Date: Wednesday, 19 January, 2011, 2:15
 Okay, it might be old question, but
 I've searched through mailing list
 archive, but haven't found the solution yet.

 I have 2 checkbox. and I want to create a checkbox
 master(when I click this
 checkbox, all the checkbox will be checked).
 I can't use the common js algorithm here, cos I can't get
 the id of the
 checkbox.

 CheckBoxPage.tml

 this is my simple code:
 script type=text/javascript
 language=JavaScript
 function checkAllDetail(){

 }
 /script
 form t:type=form t:id=newspaperForm
 input t:type=checkbox
 t:value=subscribeYahoo/Yahoo
 input t:type=checkbox
 t:value=subscribeGoogle/Google
 input type=checkbox
 id=checkAllRemove
 onclick=checkAllDetail()/Check All
 input type=submit
 value=Submit/br/
 Result :b${value}/b
 /form

 CheckBoxPage.java

 public class CheckBoxPage {
 @Property
 private boolean subscribeYahoo;
 @Property
 private boolean subscribeGoogle;
 @Persist(PersistenceConstants.FLASH)
 @Property
 private String value;

 void onSuccessFromNewspaperForm(){
 value = ;
 if(subscribeYahoo){
 value += Yahoo
 ;
 }
 if(subscribeGoogle) {
 value += Google
 ;
 }
 }
 }

 can anyone help me?

 thnx you

 dwi ardi irawan




 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




Re: Q: Java Script Check All The CheckBox?

2011-01-18 Thread Taha Hafeez
There are always other ways to select checkboxes like classnames, element
location (even xpaths are supported by some js libraries)

Having id is not always necessary

regards
Taha


On Tue, Jan 18, 2011 at 11:45 PM, dwi ardi irawan
penyihirke...@gmail.comwrote:

 Okay, it might be old question, but I've searched through mailing list
 archive, but haven't found the solution yet.

 I have 2 checkbox. and I want to create a checkbox master(when I click this
 checkbox, all the checkbox will be checked).
 I can't use the common js algorithm here, cos I can't get the id of the
 checkbox.

 CheckBoxPage.tml

 this is my simple code:
 script type=text/javascript language=JavaScript
function checkAllDetail(){

}
 /script
 form t:type=form t:id=newspaperForm
input t:type=checkbox t:value=subscribeYahoo/Yahoo
input t:type=checkbox t:value=subscribeGoogle/Google
input type=checkbox id=checkAllRemove
 onclick=checkAllDetail()/Check All
input type=submit value=Submit/br/
Result : b${value}/b
 /form

 CheckBoxPage.java

 public class CheckBoxPage {
@Property
private boolean subscribeYahoo;
@Property
private boolean subscribeGoogle;
@Persist(PersistenceConstants.FLASH)
@Property
private String value;

void onSuccessFromNewspaperForm(){
value = ;
if(subscribeYahoo){
value += Yahoo ;
}
if(subscribeGoogle) {
value += Google ;
}
}
 }

 can anyone help me?

 thnx you

 dwi ardi irawan



Re: Q: Java Script Check All The CheckBox?

2011-01-18 Thread Taha Hafeez
Yes, this is an option as are others and these can be used AFAIK. The thread
there shows a way to use it even if javascript is disabled

regards
Taha


On Wed, Jan 19, 2011 at 8:51 AM, penyihirkecil penyihirke...@gmail.comwrote:

 is there any simple way to do that without having a new component.
 I mean it just feel weird.
 this simple things should be solve using simple solution.

 the zip file from this thread:


 http://tapestry.1045711.n5.nabble.com/Disabled-button-events-are-queued-and-executed-td3341300.html

 it's weird, getting the checkbox using
 document.getElementsByTagName(INPUT) and check it whether it checkbox or
 not.

 it just my opinion,

 dwi ardi irawan



 On 19/01/2011 2:18, Shing Hing Man wrote:

 Hi,
  I have a written a component and a mixin to form a 'checkbox group'.
 If you are interested, there is online demo at
 http://lombok.demon.co.uk/tapestry5Demo/test/components/checkboxgroupdemo

 Source code download instruction is on
 http://lombok.demon.co.uk/tapestry5Demo/

 Shing



 --- On Wed, 19/1/11, dwi ardi irawanpenyihirke...@gmail.com  wrote:

  From: dwi ardi irawanpenyihirke...@gmail.com
 Subject: Q: Java Script Check All The CheckBox?
 To: users@tapestry.apache.org
 Date: Wednesday, 19 January, 2011, 2:15
 Okay, it might be old question, but
 I've searched through mailing list
 archive, but haven't found the solution yet.

 I have 2 checkbox. and I want to create a checkbox
 master(when I click this
 checkbox, all the checkbox will be checked).
 I can't use the common js algorithm here, cos I can't get
 the id of the
 checkbox.

 CheckBoxPage.tml

 this is my simple code:
 script type=text/javascript
 language=JavaScript
 function checkAllDetail(){

 }
 /script
 form t:type=form t:id=newspaperForm
 input t:type=checkbox
 t:value=subscribeYahoo/Yahoo
 input t:type=checkbox
 t:value=subscribeGoogle/Google
 input type=checkbox
 id=checkAllRemove
 onclick=checkAllDetail()/Check All
 input type=submit
 value=Submit/br/
 Result :b${value}/b
 /form

 CheckBoxPage.java

 public class CheckBoxPage {
 @Property
 private boolean subscribeYahoo;
 @Property
 private boolean subscribeGoogle;
 @Persist(PersistenceConstants.FLASH)
 @Property
 private String value;

 void onSuccessFromNewspaperForm(){
 value = ;
 if(subscribeYahoo){
 value += Yahoo
 ;
 }
 if(subscribeGoogle) {
 value += Google
 ;
 }
 }
 }

 can anyone help me?

 thnx you

 dwi ardi irawan




 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




Re: Q: Java Script Check All The CheckBox?

2011-01-18 Thread dwi ardi irawan
I agree 
this is my solution. thnx to josh canfield who give me the idea.

Instead of using document.getElementsByTagName(INPUT) then check whether
is checkbox or not, I prefer to use this method. the same idea as josh
canfield but I try to get the form element as the root of iteration, not the
input. it's to avoid if there is more than one form in one page.

IHMO(cos I doesn't have enough experiance to make an opinion which one is
better). what I mean with a simple solution is we try to do this in client
side. and we don't have to use others component.

script type=text/javascript language=JavaScript

function selectAllCheckboxes(select){

 !-- //
 var form = document.getElementById(newspaperForm);
 var checkAll = document.getElementById(checkAllRemove);
 if(checkAll.checked){
 for (var i=0;iform.length;i++)
 {
 if (form.elements[i].type == checkbox) {
 form.elements[i].checked = true;
 }
 }
 }else{
 for (var i=0;iform.length;i++)
 {
 if (form.elements[i].type == checkbox) {
 form.elements[i].checked = false;
 }
 }
 }
 // --
}
 /script

form t:type=form t:id=newspaperForm
input t:type=checkbox t:value=subscribeYahoo/Yahoo
input t:type=checkbox t:value=subscribeGoogle/Google
input type=checkbox id=checkAllRemove
onClick=selectAllCheckboxes();/Check All
input type=submit value=Submit/br/
Result : b${value}/b
/form

 I am sorry, I am not very fluently in english. ^^,

regards,

dwi ardi irawan

On Wed, Jan 19, 2011 at 12:16 PM, Taha Hafeez tawus.tapes...@gmail.comwrote:

 Yes, this is an option as are others and these can be used AFAIK. The
 thread
 there shows a way to use it even if javascript is disabled

 regards
 Taha

--