0
            <h:selectOneMenu id="customerSelection" required="true" requiredMessage="Enter/Select a customer"
                value="#{engagement.selectedDropdownCustValue}" validator="#{engagement.validateCustomer}">
                <f:selectItem itemLabel="Select Customer" itemValue="#{null}" noSelectionOption="true" itemDisabled="true" />
                <f:selectItems var="c" id="customer" itemLabel="#{c.name}" itemValue="#{c.name}" value="#{dashboard.customers}" />
                <f:selectItem itemLabel="Other" itemValue="#{null}" />
                    <p:ajax update="engagementCustomer" />
            </h:selectOneMenu>

            <p:inputText id="engagementCustomer" value="#{engagement.selectedEngagement.customer.name}"
                maxlength="30" disabled="#{engagement.selectedDropdownCustValue!=null}" validator="#{engagement.validateCustomer}" />

I want to have 'Select Customer' to be displayed in dropdown after page load, but Other is displayed by default in dropdown. Purpose of this code is to display already existing customers while creating new engagement, but if other value is selected from dropdown then input filed should be enabled and user should be allowed to enter new customer value.

Kukeltje
  • 11,924
  • 4
  • 19
  • 44
  • Several things: Does it work if you replace `p:inputText` with an `h:inputText` and `p:ajax` with `f:ajax`? If not, it is not PrimeFaces related. And please post a [mcve], otherwise it is impossible to help – Kukeltje Sep 06 '17 at 13:33
  • Yes tried using replacing p:inputText with h:inputText and p:ajax with f:ajax. It is not working for me. – Rubina Shaikh Sep 06 '17 at 13:56
  • Then I suggest to put that in the Q and remove the PF tag. Still make an [mcve] – Kukeltje Sep 06 '17 at 14:01
  • 1
    Possible duplicate of [Default selection for within ](https://stackoverflow.com/questions/5337101/default-selection-for-fselectitem-within-hselectonemenu) – ziMtyth Sep 10 '17 at 12:54

0 Answers0