0

I'm trying to use the <p:autocomplete /> of PrimeFaces 5.1, but for some reason when I load the page I receive the folowing message on the browsers console:

Uncaught TypeError: Cannot read property 'keyCode' of undefined

My view is like this:

<html 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">

<h:outputScript library="primefaces" name="jquery/jquery.js"/>
<h:outputScript library="primefaces" name="jquery/jquery-plugins.js"/>

<ui:composition>
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <p:link outcome="index" value="Chamada Parlamentar" styleClass="navbar-brand header-link" />
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <p:link href="https://github.com/Thiagokairala/reconstru-oChamadaParlametnar">
                            <h:outputText value="Código Fonte:" />
                            <p:graphicImage url="/images/github.png" />
                        </p:link>
                    </li>
                    <li>
                        <p:link href="http://dados.gov.br/dados-abertos/">
                            <h:outputText value="Lei dos Dados Abertos" />
                        </p:link>
                    </li>
                    <li>
                        <p:link outcome="about" value="Nós" />
                    </li>
                    <li>
                        <p:link outcome="help" value="Ajuda" />
                    </li>
                </ul>
                <h:form class="navbar-form navbar-right" onsubmit="#{deputyMB.statistics}">
                    <p:autoComplete value="#{deputyMB.deputyName}"
                        completeMethod="#{autoComplete.completeDeputies}" />

                </h:form>
            </div>
        </div>
    </div>
</ui:composition>

My auto complete method is like this:

package jsfConnection;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;

@ManagedBean
public class AutoComplete {

    public List<String> completeDeputies(String prefix) {
        List<String> deputies = new ArrayList<String>();
        for (int i = 0; i < 10; i++) {
            deputies.add(Integer.toString(i));
        }

        return deputies;
    }
}

How is this caused and how can I solve it?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Thiago Ramires
  • 55
  • 3
  • 10

1 Answers1

0

I fixed, it was a simple jquery conflit.

Thiago Ramires
  • 55
  • 3
  • 10