dev@jsftemplating.java.net

javascript hiddenbutton click via checkbox selection

From: Priti Tiwary <Priti.Tiwary_at_Sun.COM>
Date: Wed, 27 Sep 2006 00:14:16 -0700

Hi,
I have a button with several command events, which i want to invoke on
checkbok selection. so i am hiding the button from user and attaching
the onClick event handler of checkbox to search the button element in
form and click it . I have the following code to accomplish it , but
cannot figure out why it is not working
<sun:form id="form">
   <sun:table id="basicTable" title="Basic Table">

<sun:tableRowGroup id="rowGroup1" data={"{a=data1}", "{a=data2}"}
sourceVar="td">
                          <sun:tableColumn id="col1">
                           <sun:checkbox id="checkbox"
onClick="javascript:
document.getElementById('form:basicTable:rowGroup1:col1:testBtn').doClick();
alert('checkbox selected')"/>
                           <sun:button id="testBtn"
visible="$boolean{false}" text="Choose Me">
<!command
....several handlers
/>
                            </sun:button>
                        </sun:tableColumn>

</sun:table>
</sun:form>
Even the alert does not popup..because getElementById cannot execute
successfully...
Any ideas what is wrong ?
Priti

-- 
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Priti Tiwary          		M/S SCA16-2425
Sun Microsystems, Inc.		4160 Network Circle
Voice: +1 408 276 5559          Santa Clara, CA 95054      
Cell: +1 510 396 4431           United States