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

Reply via email to