1

following is the new code i added for dropdown list and it invokes a method and updates a text field :

<span class="label">
    <h:outputLabel for="extIdProvider" value="#{Beanclass.label}"/> 
</span>
<span class="formw">
    <h:selectOneMenu styleClass="dropDown" id="idprovider"  value="#{Bean.idprovider}" required="true" onchange="this.form.submit();" valueChangeListener="#{Bean.idProviderChanged}">                  
        <f:selectItems value="#{Bean.IdProvidersList}"/>
        <f:attribute name="fieldRef" value="extIdProvider" />
    </h:selectOneMenu>
</span>

Below is the button code :

<span class="formw">
    <br><br>                
    <h:commandButton styleClass="commandButton" value="#{Bean class.editcitizendetails_button_save}" action="#{Bean.editCitizen}"/>
    <h:commandButton styleClass="commandButton" value="#{Bean class.ebutton_cancel}" immediate="true" action="cancel" actionListener="#{Bean.cancelAction}"/>                           
    <br><br>            
</span>

nothing happens when i click save button

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Ajay
  • 11
  • 3
  • 1
    Possible duplicate of [commandButton/commandLink/ajax action/listener method not invoked or input value not set/updated](https://stackoverflow.com/questions/2118656/commandbutton-commandlink-ajax-action-listener-method-not-invoked-or-input-value) – Jasper de Vries Nov 30 '18 at 10:21
  • 1
    And drop `onchange="this.form.submit();"` like mentioned in your other question... It is (very) old school (and no it is getting 'hot' again due to the 7 year cycles) – Kukeltje Nov 30 '18 at 12:20

1 Answers1

0

This could be caused by having two h:commandButtons in the same form. Check this out: Two h:commandButton in the same h:form: one works, the other doesn't

  • no this didn't help..tried suggestions on the page e.g changed the scope to view ...didn't work – Ajay Nov 30 '18 at 11:10
  • if I use "actionListener" instead of action it calls the method but doesn't load the newly added values .It loads old values and old values entered in the text field is sent to the method – Ajay Nov 30 '18 at 11:20
  • when I comment the code for drop-down it runs fine as expected – Ajay Nov 30 '18 at 11:40