0

I've tried every keyword possible to search for my problem, so I'm asking a question here. I have the following code on my xhtml page:

<div class="form-group" >
            <h:inputText value="#{loader.redmineApiKey}" id="apiKey" 
                    class="form-control"  >
                    <f:ajax event="change" listener="#{loader.testeLoader}" render="projetos" />
                </h:inputText>
                <h:commandButton class="btn btn-sm btn-primary"
                    action="#{loader.testeLoader}" value="Carregar Projetos"></h:commandButton>
                <h:selectOneMenu value="#{loader.nomeProjetoRedmine}" class="form-control" id="projetos">
                    <f:selectItems value="#{loader.nomeProjeto}"  />    
                </h:selectOneMenu>          
            </div>

SO I want to fill the dropdown list after the value of the first inputText. The f:ajax event listener is fired, a post request is created but nothing changes in the values of the dropdown list. I have another button that calls the same method in his action and it works fine. Why it's not working in the ajax call?

Here's the method code in my bean:

    public void testeLoader() throws Exception{

    RedmineAPI red = new RedmineAPI();
    nomeProjeto = red.getProjectName(redmineApiKey);
}

Thanks for any help

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • Tried adding a `h:messages` and also updating that? Tried running the app in development mode? – Kukeltje Sep 22 '17 at 21:16
  • How the h: messages work? I don't know this component – Pedro Rodrigues Sep 23 '17 at 04:02
  • Try to use `update` in your ajax tag: `` – Muhammad Kholid B Sep 23 '17 at 06:41
  • _"How the h: messages work? I don't know this component"_ Tried google? Or the Oracle jsf tutorials ? – Kukeltje Sep 23 '17 at 06:45
  • @Eaton: Wrong suggestion... maybe read this: https://stackoverflow.com/questions/25339056/understanding-primefaces-process-update-and-jsf-fajax-execute-render-attributes – Kukeltje Sep 23 '17 at 06:50
  • https://stackoverflow.com/questions/25339056/understanding-primefaces-process-update-and-jsf-fajax-execute-render-attributes – Kukeltje Sep 23 '17 at 07:09
  • I am not using primefaces, just plain jsf. I already tried the update property too, tried update="@form" and render="@form". Aparently there is no example of a inputText populating a selectOneMenu and Im stuck and with a deadline ahead. – Pedro Rodrigues Sep 25 '17 at 15:01
  • I discovered that I have a bug related to enctype="multipart/form-data" that does not seem to work with component. When I remove the enctype the ajax component works. So, how can I fix this? I need the enctype because of the upload function in the code. – Pedro Rodrigues Sep 25 '17 at 18:23

0 Answers0