How to pass Checkbox status to jave method as parameter..

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Feb 2009
Posts: 1
Reputation: anilreddy76 is an unknown quantity at this point 
Solved Threads: 0
anilreddy76 anilreddy76 is offline Offline
Newbie Poster

How to pass Checkbox status to jave method as parameter..

 
0
  #1
Feb 23rd, 2009
Hi,

I've one checkbox,I need to capture the status of this checkbox(i.e checked is "true" and unchecked is "false") to the java method as parameter.

Please advise if there is any way i can accomplish this..

I've check box like this
[code>
<h:selectBooleanCheckbox id="checkMedia" onclick="toggleDeleteAll()"/>
[/code]
Javascript to get the status of check box like this..
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. function toggleDeleteAll(){
  2. if(deleteAll == 'false')
  3. deleteAll = 'true';
  4. else
  5. deleteAll = 'false';
  6. return deleteAll;
  7. }
I need to pass the return value of the javascript to the java method in command link action like thiss.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <h:commandLink id="delete" action="#{VehicleListingController.delete(VehicleListingController.vehicle,deleteAll)}"
  2. value="DELETE">
Please advise me if anybody has inputs..

Thanks,
Anil
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 5
Reputation: Sappster is an unknown quantity at this point 
Solved Threads: 0
Sappster Sappster is offline Offline
Newbie Poster

Re: How to pass Checkbox status to jave method as parameter..

 
0
  #2
Feb 27th, 2009
capturing the status of a checkbox in javascript

if(document.getElementById("checkBox").checked == true){
//do something
}
else{//do something else}
(where "checkBox" is replaced by the elements id you are using.)
Not sure if thats what your asking though??
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC