when i click on the p:selectBooleanCheckbox, it works but for the second click it doesn't work,why?

余生长醉 提交于 2020-01-11 14:42:11

问题


I have a "p:selectBooleanCheckbox" in my xhtml page. I have inserted this code selected="true" to make it checked by default. SO when i run the page, and click for the first time it becames "unchecked" , but since then when i click on it it still unchecked , it doesn't change.
So to reseume =>my p:selectBooleanCheckbox is clickable just once after that when i click on it, it doesn't change (it still unchekeced)

this is the code in my xhtml page:

<div class="row">
 <p:outputLabel for="spec_telOwner" value="Propriétaire du num"    styleClass="col-md-3 control-label" />
     <div class="col-md-3">
      <div class="input-icon right">
       <p:selectBooleanCheckbox  selected="true"  id="spec_telOwner"   value="#{searchEngine.spec.phoneLineOwner}"/>
      </div>
    </div>
 </div>

i'm using eclipse sts , and i run my application on InternetExplorer.


回答1:


<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:evoice="http://ccs.tn/taglib/evoice">
    <ui:include src="CloseTicketDialog.xhtml" />

    <div class="form-body pal">
        <div class="row">
            <p:outputLabel for="call_from_tel_number"
                styleClass="col-md-2 control-label" value="Numéro Entrant" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <i class="fa fa-phone" />
                    <p:inputText id="call_from_tel_number" maxlength="32" size="9"
                        value="#{ticketController.ticket.callFromTelNumber}"
                        validatorMessage="Numéro Entrant : Composé au minimum par 8 chiffres dans [0..9]."
                        styleClass="form-control">
                        <f:validateRegex pattern="[0-9\s]*" />
                        <f:validateLength minimum="8" maximum="32" />
                        <p:ajax event="blur" id="ajax_call" disabled="#{ticketController.ticket.ticketId ne null}"
                            process="call_from_tel_number,form:growl" 
                            update="form:growl,form:tab_view:lastName, form:tab_view:firstName"
                            listener="#{ticketController.queryOldTickets(ticketController.ticket)}"
                            onstart="PF('statusDialog').show()"
                            oncomplete="PF('statusDialog').hide()"/>
                    </p:inputText>
                </div>
            </div>
            <p:outputLabel for="reply_to_tel_number" value="Deuxièmme Numéro"
                styleClass="col-md-3 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <i class="fa fa-phone" />
                    <p:inputText id="reply_to_tel_number" maxlength="32" size="9"
                        readonly="{ticketController.ticket.ticketId ne null}"
                        value="#{ticketController.ticket.otherPhonenum}"
                        validatorMessage="Deuxièmme Numéro : Accepte seulement des chiffres dans [0..9]."
                        styleClass="form-control">
                        <f:validateRegex pattern="[0-9]*" />
                    </p:inputText>
                </div>
            </div>
        </div>
                <div class="form-group" />
        <div class="row">
            <p:outputLabel for="telOwner" value="proprietaire de num"
                styleClass="col-md-2 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                      <p:selectBooleanCheckbox  selected="true"  id="telOwner" value="#{ticketController.ticket.phoneLineOwner}"  />          

                </div>
            </div>
        </div>

        <div class="form-group" />

        <div class="row">
            <p:outputLabel for="lastName" value="#{i18n['name']}"
                styleClass="col-md-2 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <i class="fa fa-user" />
                    <p:inputText id="lastName"
                        readonly="{ticketController.ticket.ticketId ne null}"
                        value="#{ticketController.ticket.lastName}"
                        styleClass="form-control" />
                </div>
            </div>
            <p:outputLabel for="firstName" value="Prénom"
                styleClass="col-md-3 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <i class="fa fa-user" />
                    <p:inputText id="firstName"
                        readonly="{ticketController.ticket.ticketId ne null}"
                        value="#{ticketController.ticket.firstName}"
                        styleClass="form-control" />
                </div>
            </div>
        </div>
        <div class="form-group" />
        <div class="row">
            <p:outputLabel for="subject" value="#{i18n['ticket.purpose']}"
                styleClass="col-md-2 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <p:selectOneMenu style="width:268px" id="subject" filter="true"
                        filterMatchMode="contains" converter="#{ticketSubjectConverter}"
                        value="#{ticketController.ticket.subject}">
                        <p:ajax event="change" process="subject" update="openTicketRating"
                            listener="#{satisfactionRatingLoV.onSubjectChange(ticketController.ticket.subjectId)}" />
                        <f:selectItem itemLabel="Séléctionner Motif" itemValue="#{null}" noSelectionOption="true" itemDisabled="true"/>
                        <f:selectItems value="#{ticketSubjectLoV.subjects}" var="subject"
                            itemLabel="#{subject.subject}" itemValue="#{subject}" />
                    </p:selectOneMenu>
                </div>
            </div>
            <p:outputLabel for="store" value="Magasin"
                styleClass="col-md-3 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <p:selectOneMenu style="width:268px" id="store" filter="true"
                        disabled="{ticketController.ticket.ticketId ne null}"
                        filterMatchMode="contains"
                        value="#{ticketController.ticket.store}"
                        converter="#{storeConverter}"
                        >
                        <f:selectItem itemLabel="" itemValue="#{null}" noSelectionOption="true" itemDisabled="true"/>
                        <f:selectItems value="#{storeLoV.stores}" var="store" itemLabel="#{store.name}" itemValue="#{store}" />
                    </p:selectOneMenu>
                </div>
            </div>
        </div>
        <div class="form-group" />

        <div class="row">
            <p:outputLabel for="category" styleClass="col-md-2 control-label"
                value="Catégorie" />
            <div class="col-md-3">
                <div>
                    <p:selectCheckboxMenu id="category"
                        value="#{ticketController.ticket.ticketCategories}"
                        converter="#{ticketCategoryConverter}" label="Séléctionner"
                        style="width:268px" filter="true" filterMatchMode="contains">
                        <p:ajax event="change" process="@this"
                            update="sub_category_select,view_category"
                            onstart="PF('statusDialog').show()"
                            oncomplete="PF('statusDialog').hide()"
                            listener="#{ticketCategoryLOV.onCategoryChange(ticketController.ticket.ticketCategories)}" />

                        <f:selectItems value="#{ticketCategoryLOV.categories}"
                            var="category" itemValue="#{category}"
                            itemLabel="#{category.name}" />

                        <f:attribute name="collectionType" value="java.util.ArrayList" />
                    </p:selectCheckboxMenu>
                    <p:dataList id="view_category"
                        value="#{ticketController.ticket.ticketCategories}" var="cat"
                        emptyMessage="">
                                                #{cat.name}
                        </p:dataList>
                </div>
            </div>
            <p:outputLabel for="sub_category_select"
                styleClass="col-md-3 control-label" value="#{i18n['subcategory']}" />
            <div class="col-md-3">
                <div>
                    <p:selectCheckboxMenu id="sub_category_select" style="width:268px"
                        filter="true" filterMatchMode="contains" 
                        converter="#{ticketSubCategoryConverter}"
                        value="#{ticketController.ticket.subCategories}">
                        <p:ajax event="change" process="form:tab_view:sub_category_select"
                            update="view_Subcategories" />
                        <f:selectItem itemLabel="Séléctionner Sous Catégorie"
                            noSelectionOption="true" itemValue="#{null}" itemDisabled="true" />
                        <f:selectItems id="selectSubCategoryList"
                            value="#{ticketCategoryLOV.subCategories}" var="subCategory"
                            itemValue="#{subCategory}" itemLabel="#{subCategory.name}" />
                        <f:attribute name="collectionType" value="java.util.ArrayList" />
                    </p:selectCheckboxMenu>
                    <p:dataList id="view_Subcategories"
                        value="#{ticketController.ticket.subCategories}" var="subCat"
                        emptyMessage="" style="width:300px">
                                                #{subCat.name}
                    </p:dataList>
                </div>

            </div>
        </div>
        <div class="form-group" />
        <div class="form-group" />
        <div class="row">
            <p:outputLabel for="loyalty_card_owner"
                value="Titulaire Carte. Fid"
                styleClass="col-md-2 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <p:selectOneMenu id="loyalty_card_owner" style="width:268px"
                        disabled="{ticketController.ticket.ticketId ne null}"
                        value="#{ticketController.ticket.loyaltyCardOwner}">
                        <f:selectItem itemLabel="#{i18n['no_response']}" itemValue="NA" />
                        <f:selectItem itemLabel="#{i18n['yes']}" itemValue="YES" />
                        <f:selectItem itemLabel="#{i18n['no']}" itemValue="NO" />
                        <p:ajax event="change" process="loyalty_card_owner"
                            update="loyaltycardnumber" />
                    </p:selectOneMenu>
                </div>
            </div>
            <p:outputLabel for="loyaltycardnumber" value="Numéro Carte Fid.:"
                styleClass="col-md-3 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <i class="fa fa-pencil" />
                    <p:inputText id="loyaltycardnumber"
                        readonly="{ticketController.ticket.ticketId ne null}"
                        disabled="#{ticketController.ticket.loyaltyCardOwner eq 'NA' or ticketController.ticket.loyaltyCardOwner eq 'NO'}"
                        maxlength="15" size="15"
                        value="#{ticketController.ticket.loyaltyCardNumber}"
                        styleClass="form-control">
                        <f:validateLength minimum="15" maximum="15" />
                    </p:inputText>
                </div>
            </div>
        </div>
        <div class="form-group" />
        <div class="row">

            <p:outputLabel for="moreInfoPopup" value="Information Fidélité"
                styleClass="col-md-2 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <evoice:loyaltyCard ticket="#{ticketController.ticket}" />
                    <h:graphicImage name="#{jsfProp.img_png_cartefid}"
                        id="moreInfoPopup" onclick="PF('moreInfoDlg').show()"
                        styleClass="img-responsive" />
                </div>
            </div>
        </div>
        <div class="form-group" />
        <div class="row">
            <p:outputLabel for="openTicketRating"
                value="#{i18n['ticket.statisfaction.open']}"
                styleClass="col-md-2 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <p:selectOneMenu id="openTicketRating" style="width:268px"
                        disabled="#{ticketController.ticket.ticketId ne null}"
                        converter="#{openSatisfactionConverter}"
                        value="#{ticketController.ticket.openSatisfaction}">
                        <f:selectItem itemLabel="Select Satisfaction" itemValue="${null}" />
                        <f:selectItems
                            value="#{satisfactionRatingLoV.openSatisfactionList}"
                            var="satisfaction" itemLabel="#{satisfaction.lookupValue}"
                            itemValue="#{satisfaction}" />
                    </p:selectOneMenu>
                </div>
            </div>
            <p:outputLabel id="label_ticket_a_relancer"
                for="ticket_a_relancer_input" value="Ticket Relance"
                styleClass="col-md-3 control-label" />
            <div class="col-md-3">
                <div class="input-icon right">
                    <p:inputText id="ticket_a_relancer_input" styleClass="form-control"
                        readonly="true" value="#{ticketController.ticket.parentTicketId}" />
                </div>
            </div>
        </div>
        <div class="form-group" />
        <div class="row">
            <p:outputLabel for="open_tkt_comment"
                value="#{i18n['ticket.comment.open']}"
                styleClass="col-md-2 control-label" />
            <div class="col-md-9">
                <div class="form-group">
                    <div class="input-icon right">
                        <i class="fa fa-pencil" />
                        <p:inputTextarea id="open_tkt_comment" rows="7" cols="120"
                            styleClass="form-control"
                            value="#{ticketController.ticket.openComment}"
                            counter="displayRemainingOpenCmnt" maxlength="4096"
                            counterTemplate="{0} charactère(s) restants." />
                        <h:outputText id="displayRemainingOpenCmnt" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <p:messages id="messages" showDetail="true" autoUpdate="true"
        closable="true" />
    <div class="form-actions pal">
        <div class="form-group mbn">
            <div class="col-md-offset-3 col-md-9">
                <p:commandButton value="Annuler" id="rezetBtn"
                    disabled="{ticketController.ticket.ticketId ne null}"
                    immediate="true" update="form:tab_view" process="@this"
                    actionListener="#{ticketController.reset}">
                    <p:resetInput target="form:tab_view" />
                </p:commandButton>
                <p:spacer width="20" height="20" />
                <p:splitButton value="#{i18n['save']}" type="submit" id="saveButton"
                    onstart="PF('statusDialog').show()"
                    oncomplete="PF('statusDialog').hide()"
                    action="#{ticketController.saveTicket}"
                    actionListener="#{ticketController.validate}"
                    process="form:tab_view:fiche_ticket_tab"
                    update="@form, form:tab_view:tickets_table" icon="ui-icon-disk"
                    >

                    <p:menuitem id="closeTicketCmdBtnWv" value="Clôturer"
                        immediate="true" 
                        disabled="#{ticketController.ticket.ticketId eq null}"
                        icon="ui-icon-locked" onclick="PF('closeTicketDlgWv').show()" >
                        </p:menuitem>
                    <p:menuitem value="Notification" immediate="true"
                        action="/pages/secure/notification/mailbox.xhtml" ajax="false"
                        icon="ui-icon-mail-closed">
                        <f:param id="NotificationParam" name="mail_box_active_tab"
                            value="edit_notification_tab" />
                        <f:param id="NotificationTicketIdParam"
                            name="INIT_NOTIF_TICKET_ID_PARAM"
                            value="#{ticketController.ticket.ticketId}" />
                    </p:menuitem>
                    <p:separator />
                </p:splitButton>
                <p:spacer width="20" height="20" />
            </div>
        </div>
    </div>
</ui:composition>


来源:https://stackoverflow.com/questions/43028841/when-i-click-on-the-pselectbooleancheckbox-it-works-but-for-the-second-click-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!