Hi,
I am new to PrimeFaces and having problems to set focus.
I have some views. In each view I would like to set focus to one inputtext.
Just the first one get the focus (in the home view).
Can anyone explain what I am doing wrong?
I'm using <p:focus for = "textID"/>
best regards,
Luiz
Having trouble with focus (solved)
-
- Posts: 4
- Joined: 07 Jul 2010, 22:57
Last edited by luizbarbosa on 22 Jul 2010, 14:09, edited 1 time in total.
NetBeans IDE 6.9, Mojarra 2.0.2, JSF-2.0, and PrimeFaces-2.0.2 on GlassFish v3
you need to provide some more info (Forum Posting Guidelines).
some more code (xhtml and managedBean)?
some more code (xhtml and managedBean)?
JSF-2.0, mojarra-2.0.2-FCS and PrimeFaces-2.1 on GlassFish v3.0.1 (build 22)
-
- Posts: 4
- Joined: 07 Jul 2010, 22:57
Hi,
my index.xhtml:
best regards,
Luiz
my index.xhtml:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:i="http://primefaces.prime.com.tr/touch"
contentType="text/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<i:application >
<i:view id="vHome" title="wMove">
<p:messages globalOnly="true"/>
<h:form>
<h:outputLabel value="#{funcionarioMB.logado?funcionarioMB.funcionario.nome:''}"/><p></p>
<i:tableView>
<i:rowGroup >
<i:rowItem value="#{funcionarioMB.logado?'Logout':'Login'}" view="vLogin" actionListener="document.getElementById('fLogin:iMat').focus();" />
<i:rowItem value="Movimentacao" view="vMovimentacao" rendered="#{funcionarioMB.logado}"/>
</i:rowGroup>
</i:tableView>
</h:form>
</i:view>
<i:view id="vLogin" title="wMove" >
<f:facet name="leftNavBar">
<i:navBarControl label="Volta" view="vHome" type="button" effect="slideup"/>
</f:facet>
<h:form id="fLogin" title="wMove" >
<i:tableView>
<i:rowGroup title="Matricula:">
<i:rowItem>
<h:inputText id ="matricula" value="#{funcionarioMB.funcionario.matricula}"/>
<p:focus for="matricula"/>
</i:rowItem>
</i:rowGroup>
</i:tableView>
<h:commandLink actionListener="#{funcionarioMB.login}" style="margin:0 10px;" styleClass="whiteButton">Confirma</h:commandLink>
</h:form>
</i:view>
<i:view id="vMovimentacao" title="wMove">
<f:facet name="leftNavBar">
<i:navBarControl label="Volta" view="vHome" type="button" effect="slideup"/>
</f:facet>
<h:form>
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<i:tableView>
<i:rowGroup >
<i:rowItem value="Etiqueta Origem" view="vOrigem"/>
<i:rowItem value="Etiqueta Destino" view="vDestino"/>
</i:rowGroup>
</i:tableView>
</h:form>
</i:view>
<i:view id="vOrigem" title="Etiqueta Origem">
<f:facet name="leftNavBar">
<i:navBarControl label="Volta" view="vMovimentacao" type="button" effect="slideup"/>
</f:facet>
<h:form id="teste">
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<p:messages />
<h:inputText id="etqOrigem" value="" />
<p:focus for="etqOrigem"/>
</h:form>
</i:view>
<i:view id="vDestino" title="Etiqueta Destino" >
<f:facet name="leftNavBar">
<i:navBarControl label="Volta" view="vMovimentacao" type="button" effect="slideup"/>
</f:facet>
<h:form id="detDestino" >
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<h:outputLabel value="Descricao"/><p></p>
<i:tableView>
<i:rowGroup >
<i:rowItem>
<h:inputText id ="etqDestino" value="" required="true"/>
<p:focus for="etqDestino"/>
</i:rowItem>
</i:rowGroup>
</i:tableView>
</h:form>
</i:view>
</i:application>
</f:view>
Luiz
NetBeans IDE 6.9, Mojarra 2.0.2, JSF-2.0, and PrimeFaces-2.0.2 on GlassFish v3
-
- Posts: 4
- Joined: 07 Jul 2010, 22:57
Hi,
I figured out using java script.
Luiz
I figured out using java script.
Luiz
NetBeans IDE 6.9, Mojarra 2.0.2, JSF-2.0, and PrimeFaces-2.0.2 on GlassFish v3
-
- Information
-
Who is online
Users browsing this forum: No registered users and 10 guests