0

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

<h:selectBooleanCheckbox  id="checkMedia" onclick="toggleDeleteAll()"/>

Javascript to get the status of check box like this..

 function toggleDeleteAll(){
        if(deleteAll == 'false')
            deleteAll = 'true';
        else
            deleteAll = 'false';
        return  deleteAll;
    }

I need to pass the return value of the javascript to the java method in command link action like thiss.

<h:commandLink id="delete"                                        action="#{VehicleListingController.delete(VehicleListingController.vehicle,deleteAll)}"
                                        value="DELETE">

Please advise me if anybody has inputs..

Thanks,
Anil

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Sappster
0

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??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.