Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7418631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:55:15+00:00 2026-05-29T07:55:15+00:00

I have a xhtml page in which there can be 0 to 6 check

  • 0

I have a xhtml page in which there can be 0 to 6 check boxes independent of each other. I want to make sure when all of them are checked, submit button is enabled. Let say there are 3 checkboxes, only when these 3 checkboxes are clicked, the submit button must be enabled. Looking for a solution in JSF / Javascript.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:55:17+00:00Added an answer on May 29, 2026 at 7:55 am

    Below is the code what I came up with, JSF/Seam dont really have a clean solution for implementing checkboxes, in fact JSF itself is shit like a diamond in the sky. Groovy is much lighter and clean. Took me an HOUR to figure out , with JQuery this should have been faster and easy peasy, but that would my future refactoring effort. Thanks to Andrey and Mugur. Time to focus on integrating this shit with CXF Web Services. I have tried to clean as much as possible and post the solution, if there are any mistakes my apologies, any java kid should be able to figure out mistakes.

    Andrey : Your solution was fine for any regular application, its just that when JSF components are rendered as HTML, the component tree generates lot of input checkboxes, for 6 input checkboxes the component tree generated 170, thanks to JSF. No wonder why Sun sold out.

    <h:form id="cbrRulesForm">
        <a4j:region id="googleCompeteRules">
    
            <s:div id="cbrRules">
                <div style="height:100px;">
                    <div class="section-right">
                        <div>                            
                            <s:label styleClass="name" rendered="#{actionBean.ruleResult[0].equalsIgnoreCase('FAIL')}" style="margin-top: -40px;padding-left: 250px;">
                                     <h:selectBooleanCheckbox id="waiveRuleCheck1" value="#{actionBean.waiveRule1Checked}" disabled="#{!identity.hasRole('Agent')}">
                                        <a4j:support event="onclick"  action="#{actionBean.showButton()}" ajaxSingle="true" reRender="googleCompeteSubmitId"/>
                                     </h:selectBooleanCheckbox>
                                 Waived</s:label>
                        </div>
    
                        <div>
                                 <s:label styleClass="name" rendered="#{actionBean.ruleResult[1].equalsIgnoreCase('FAIL')}" style="margin-top: -52px;padding-left: 250px;">
                                             <h:selectBooleanCheckbox id="waiveRuleCheck2" value="#{actionBean.waiveRule2Checked}" >
                                                <a4j:support event="onclick" action="#{actionBean.showButton()}"  ajaxSingle="true" reRender="googleCompeteSubmitId"/>
                                             </h:selectBooleanCheckbox>
                                         Waived</s:label>
                        </div>
                        <div style="clear:both"/>
                    </div>
                </div>
    
                <div>
                    <div class="section-right" style="margin-top:-20px;">
    
    
                                     <s:label styleClass="name" rendered="#{actionBean.ruleResult[2].equalsIgnoreCase('FAIL')}" style="margin-top: -52px;padding-left: 250px;">
                                             <h:selectBooleanCheckbox id="waiveRuleCheck3" value="#{actionBean.waiveRule3Checked}" >
                                                <a4j:support event="onclick" action="#{actionBean.showButton()}"   ajaxSingle="true" reRender="googleCompeteSubmitId"/>
                                             </h:selectBooleanCheckbox>
                                         Waived</s:label>
    
    
                        <div style="clear:both"/>
                    </div>
    
                </div>
    
    
                <div>
                    <div class="section-right" style="margin-top:-20px;">
    
                                    <s:label styleClass="name" rendered="#{actionBean.ruleResult[3].equalsIgnoreCase('FAIL')}" style="margin-top: -52px;padding-left: 250px;">
                                             <h:selectBooleanCheckbox id="waiveRuleCheck4" value="#{actionBean.waiveRule4Checked}" >
                                                <a4j:support event="onclick" action="#{actionBean.showButton()}"   ajaxSingle="true" reRender="googleCompeteSubmitId"/>
                                             </h:selectBooleanCheckbox>
                                         Waived</s:label>
                    </div>
                    <div style="clear:both"/>
                </div>
    
    
                <div>
                    <div class="section-right" style="margin-top:-20px;">
    
                                    <s:label styleClass="name" rendered="#{actionBean.ruleResult[4].equalsIgnoreCase('FAIL')}" style="margin-top: -52px;padding-left: 250px;">
                                             <h:selectBooleanCheckbox id="waiveRuleCheck5" value="#{actionBean.waiveRule5Checked}" >
                                                <a4j:support event="onclick" action="#{actionBean.showButton()}"   ajaxSingle="true" reRender="googleCompeteSubmitId"/>
                                             </h:selectBooleanCheckbox>
                                         Waived</s:label>
                    </div>
                  <div style="clear:both"/>
                </div>
    
                <div>
                    <div class="section-right" style="margin-top:-20px;">
    
                                     <s:label styleClass="name" rendered="#{actionBean.ruleResult[5].equalsIgnoreCase('FAIL')}" style="margin-top: -52px;padding-left: 250px;">
                                             <h:selectBooleanCheckbox id="waiveRuleCheck6" styleClass="float: right;" value="#{actionBean.waiveRule6Checked}" >
                                                <a4j:support event="onclick" action="#{actionBean.showButton()}"   ajaxSingle="true" reRender="googleCompeteSubmitId"/>
                                             </h:selectBooleanCheckbox>
                                         Waived</s:label>
    
                    </div>
                     <div style="clear:both"/>
                </div>
    
                <div style="float:right">
                                    <a4j:commandButton id="googleCompeteSubmitId"
                                                     action="#{actionBean.submitDecision()}"
                                                     reRender="googleCompeteRules"
                                                     limitToList="true"
                                                     disabled="#{actionBean.btnDisabled}"
                                                     value="Submit"
                                                     type="submit"/>
             </div>
    
            </s:div>
        </a4j:region>
    </h:form>
    

    ActionBean.java

    @Name("actionBean")
    @Scope(ScopeType.CONVERSATION)
    @Synchronized(timeout = 60000L)
    @AutoCreate
    public class ActionBean {
    
    @Out(required = false)
    private GoogleCompete googleCompete;
    
    private int checkCount = 0;
    
    private int failCount = 0;
    
    private boolean disableButton = true;
    
    /*
    6 WAIVE RULES CHECK BOXES FOR VALIDATION
    */
    private boolean waiveRule1Checked;
    private boolean waiveRule2Checked;
    private boolean waiveRule3Checked;
    private boolean waiveRule4Checked;
    private boolean waiveRule5Checked;
    private boolean waiveRule6Checked;
    
    public boolean isWaiveRule1Checked() {
        return waiveRule1Checked;
    }
    
    public void setWaiveRule1Checked(boolean waiveRule1Checked) {
        if(waiveRule1Checked) {
           checkCount++;
        } else {
          checkCount--;
        }
        this.waiveRule1Checked = waiveRule1Checked;
    }
    
    public boolean isWaiveRule2Checked() {
        return waiveRule2Checked;
    }
    
    public void setWaiveRule2Checked(boolean waiveRule2Checked) {
        if(waiveRule2Checked) {
           checkCount++;
        } else {
          checkCount--;
        }
        this.waiveRule2Checked = waiveRule2Checked;
    }
    
    public boolean isWaiveRule3Checked() {
        return waiveRule3Checked;
    }
    
    public void setWaiveRule3Checked(boolean waiveRule3Checked) {
        if(waiveRule3Checked) {
           checkCount++;
        } else {
          checkCount--;
        }
        this.waiveRule3Checked = waiveRule3Checked;
    }
    
    public boolean isWaiveRule4Checked() {
        return waiveRule4Checked;
    }
    
    public void setWaiveRule4Checked(boolean waiveRule4Checked) {
        if(waiveRule4Checked) {
           checkCount++;
        } else {
          checkCount--;
        }
        this.waiveRule4Checked = waiveRule4Checked;
    }
    
    public boolean isWaiveRule5Checked() {
        return waiveRule5Checked;
    }
    
    public void setWaiveRule5Checked(boolean waiveRule5Checked) {
        if(waiveRule5Checked) {
           checkCount++;
        } else {
          checkCount--;
        }
        this.waiveRule5Checked = waiveRule5Checked;
    }
    
    public boolean isWaiveRule6Checked() {
        return waiveRule6Checked;
    }
    
    public void setWaiveRule6Checked(boolean waiveRule6Checked) {
        if(waiveRule6Checked) {
           checkCount++;
        } else {
          checkCount--;
        }
        this.waiveRule6Checked = waiveRule6Checked;
    }
    
    public boolean isBtnDisabled() {
        return  disableButton;
    }
    
    public void showButton() {
        disableButton = checkCount != failCount;
    }
    
    
    private GoogleCompete fetchInformationFromAmazon(long customerAccountId) {
         googleCompete = getInfoFromJavaCXFWebService();
         ruleResult = googleCompete.getCbrRules().toArray(ruleResult);
    
         for (String s: ruleResult) {
             if(s.equals("FAIL")) {
                failCount++;
             }
         }
         return googleCompete;
    }
    
    public void submitDecision() {
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a well formed XHTML page. I want to find the destination URL
I have a JSP page in a JSF application which uses A4J. I want
I have a login page, which I check if the user exist in my
I have an embedded device which runs Java applications which can among other things
In my xhtml page I have the following tag included: <f:view locale=#{languageBean.locale}> ... </f:view>
Trying to use JSTL but have the following problem: Index.xhtml page: <?xml version=1.0 encoding=UTF-8?>
I have the following markup inside a master page <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server>
I have 9 DTD files example xhtml dtd1 xhtml dtd2 I want to create
I have a table that displays pictures in each td element. The page is
I am using helios 3.6.2. I have an .xhtml opened with Web Page Editor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.