Pessoal, boa noite.
Vê se vocês podem me ajudar. Tou com a seguinte situação.
Estou usando Seam + JSF+Hibernate.
Possuo um formulário com alguns campos requeridos (required=true).
E a situação ocorre quando tento “zerar”(Limpar) meu formulário.
Caso eu acesse o primeiro campo requerido e digite alguma informação e deixe os outros em branco, ao clicar em salvar é apresentado na tela a validação dos campos que não foram preenchidos, até aí tudo bem. Porém, se eu clicar em NOVO(limpar o formulario . Meu bean Instancea o objeto novamente
new Objeto()) todos os campos voltam a ficar em branco MENOS o campo inicial.
O que fazer para que ele renderize esse campo com o novo valor do Bean?
Formulario
<a4j:form>
<a4j:region id="regiaotitulos" renderRegionOnly="true" >
<rich:panel id="paneldadostitulo" >
<f:facet name="header">
<h:outputText value="Dados do titulo" />
</f:facet>
<h:panelGrid columns="2" id="gridtitulos">
<h:panelGrid columns="1" id="panelintDadosmov">
<a4j:region id="docTst">
<s:decorate id="docDisplay" template="/layout/edit.xhtml" >
<ui:define name="label">
<h:outputText value="Documento" />
</ui:define>
<h:inputText id="mov_doc" value="#{movimentacaohandler.movimentacao.doc}"
readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}"
style="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm ? 'color :gray;' : '' }"
required="true" >
</h:inputText>
</s:decorate>
</a4j:region>
<s:decorate id="nomeDisplay" template="/layout/display.xhtml">
<ui:define name="label">
<h:outputText value="Parcela" />
</ui:defi
ne>
<h:inputText id="mov_parcela" value="#{movimentacaohandler.movimentacao.parcela}" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" style="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm ? 'color :gray;' : '' }">
</h:inputText>
</s:decorate>
<s:decorate id="tipodocDisplay" template="/layout/edit.xhtml" >
<ui:define name="label">
<h:outputText value="Tipo" />
</ui:define>
<h:selectOneMenu id="tipo_doc" value="#{movimentacaohandler.idtipodoc}" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" style="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm ? 'color :gray;' : '' }" required="true" >
<f:selectItem itemValue="0" itemLabel="Selecione" />
<f:selectItems id="choseDoc" value="#{tipodochandler.comboTipoDoc}" />
</h:selectOneMenu>
</s:decorate>
<s:decorate id="dtVencDocDisplay" template="/layout/edit.xhtml" >
<ui:define name="label">
<h:outputText value="Data Vencimento Documento" />
</ui:define>
<rich:calendar id="data_venc_doc" value="#{movimentacaohandler.movimentacao.datavencimentodocumento}" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}"
datePattern="dd/MM/yyyy" enableManualInput="true" cellWidth="24px" cellHeight="22px" style="width:200px" required="true" requiredMessage="Data de vencimento requerida.">
<a4j:support event="onkeypress" action="return tabEnter(this, event);" />
<a4j:support reRender="paneldadostitulo" immediate="true"
event="oninputchange" limitToList="true"
eventsQueue="keypressQueue" />
</rich:calendar>
</s:decorate>
<s:decorate id="vloriginalDisplay" template="/layout/edit.xhtml" >
<ui:define name="label">
<h:outputText value="Valor original" />
</ui:define>
<h:inputText id="valor_origi_mov" required="true" value="#{movimentacaohandler.movimentacao.valormovimento}" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}"
requiredMessage="Campo obrigatorio">
<f:converter converterId="MyDoubleConverter" />
<a4j:support event="onblur" reRender="vloriginalDisplay,paneldadostitulojuros"/>
</h:inputText>
</s:decorate>
<s:decorate id="dtEscritDisplay" template="/layout/edit.xhtml" >
<ui:define name="label">
<h:outputText value="Data Vencimento Escritorio" />
</ui:define>
<rich:calendar id="dt_venc_esc" value="#{movimentacaohandler.movimentacao.datavencimentodocartorio}" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}"
datePattern="dd/MM/yyyy" enableManualInput="true" cellWidth="24px" cellHeight="22px" style="width:200px" required="true" requiredMessage="Data requerida." >
<a4j:support event="onkeypress" action="return tabEnter(this, event);" />
<a4j:support reRender="paneldadostitulojuros"
event="onchange" limitToList="true"
eventsQueue="keypressQueue" />
</rich:calendar>
</s:decorate>
<s:decorate id="perjurosDisplay" template="/layout/display.xhtml">
<ui:define name="label">
<h:outputText value="Perc. Juros(%)" />
</ui:define>
<h:inputText id="perc_juros_def" value="#{movimentacaohandler.movimentacao.percjurosdefault}" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}">
<f:converter converterId="MyDoubleConverter" />
<a4j:support event="onblur" reRender="paneldadostitulojuros,perc_juros_def" />
</h:inputText>
</s:decorate>
<s:decorate id="perHonorDisplay" template="/layout/display.xhtml">
<ui:define name="label">
<h:outputText value="Perc. Honorario(%)" />
</ui:define>
<h:inputText id="perc_honora" value="#{movimentacaohandler.movimentacao.perchonorario}" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}">
<f:converter converterId="MyDoubleConverter" />
<a4j:support event="onblur" reRender="paneldadostitulojuros, perc_honora"/>
</h:inputText>
</s:decorate>
<s:decorate id="protestoDisplay" template="/layout/display.xhtml">
<ui:define name="label">
<h:outputText value="Protesto" />
</ui:define>
<h:inputText id="vlprot" value="#{movimentacaohandler.movimentacao.valorprotesto}" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}">
<f:converter converterId="MyDoubleConverter" />
<a4j:support event="onblur" reRender="paneldadostitulojuros, vlprot"/>
</h:inputText>
</s:decorate>
<h:outputLabel value="Observacao" for="" />
<h:inputTextarea value="#{movimentacaohandler.movimentacao.obs}" style="width : 268px; height : 107px;" readonly="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}" disabled="#{movimentacaohandler.tituloCarregado and not movimentacaohandler.editForm}"/>
</h:panelGrid>
........
</h:panelGrid>
</rich:panel>
</a4j:region>
<a4j:region>
<a4j:commandButton id="btn_novo" action="#{movimentacaohandler.novoMovimentacao}"
value="Novo" immediate="true" ajaxSingle="true" limitToList="true"
reRender="formMovimentacao, docTst, mov_doc" />
</a4j:region>
<a4j:commandButton id="botao_salvar" actionListener="#{movimentacaohandler.salvar(event,credentials.username)}" value="Salvar"
reRender="formMovimentacao,panel_atalhos,paneldadostitulo,form_atalhos"
rendered="#{(not movimentacaohandler.tituloCarregado or movimentacaohandler.editForm)
and identity.hasRole('TITULOS/NOVO') }">
</a4j:commandButton>
</a4j:form>
Bean
public void novoMovimentacao(){
this.movimentacao = new Movimentacao();
}
Obs.: Quando todos os campo estão Preenchidos, ou seja, a validação está ok ao clicar em NOVO é executadao normalmente limpando todos os campos.
Quem poder dar uma força… vlww!!!
