Alchemist 17 de ago. de 2010
Pessoal eu tive uma ideia mais não está funcionando se alguem poder ajudar
este é o meu radio
<h:selectOneRadio id= "selCpfCnpj" style= "width:225px;" label= " ${ b [ 'comum.cpfcnpj' ] } "
value= "#{meuMB.cnpjCpf}" >
<f:selectItem itemLabel= " ${ b [ 'comum.cnpj' ] } " itemValue= "S" />
<f:selectItem itemLabel= " ${ b [ 'comum.cpf' ] } " itemValue= "N" />
<a4j:support event= "onclick"
ajaxSingle= "true"
reRender= "inputTextCnpjCpf"
action= "#{meuMB.doLimparCampoCnpjCpf}"/ >
</h:selectOneRadio>
E dentro do meu formulario em uma celula de tabela eu fiz isto:
<a4j:region id= "inputTextCnpjCpf" >
<h:inputText id= "txtCnpj" label= " ${ b [ 'comum.cpfcnpj' ] } " rendered= "#{meuMB.cnpjCpf == 'S'}"
value= "#{meuMB.object.cnpj}"
styleClass= "inputTexto"
converter= "CpfConverter"
validator= "CpfValidator"
style= "width:155px;"
disabled= "#{meuMB.desabilitaCampoCnpjCpf}" >
</h:inputText>
<h:inputText id= "txtCpf" label= " ${ b [ 'comum.cpfcnpj' ] } " rendered= "#{meuMB.cnpjCpf == 'N'}"
value= "#{meuMB.object.cnpj}"
styleClass= "inputTexto"
converter= "CnpjConverter"
validator= "CnpjValidator"
style= "width:155px;"
disabled= "#{meuMB.desabilitaCampoCnpjCpf}" >
</h:inputText>
</a4j:region>
e as minhas mascaras estão assim no alto do formulario:
< rich : jQuery query = "setMask({mask: '[CPF removido]'})"
selector = "#txtCpf"
timing = "onJScall"
name = "maskCPF"
id = "maskCPF" />
< rich : jQuery query = "setMask({mask: '99.999.999/9999-99'})"
selector = "#txtCnpj"
timing = "onJScall"
name = "txtCnpj"
id = "txtCnpj" />
Porem o meu formulario não estas renderizando certinho, :s alguem pode ajudar ?
Alchemist 18 de ago. de 2010
Vortei, consegui resolver o problema acho que o a4j:region não estava reenderizando os componentes que estavam dentro dele, então eu acabei usando um <h:panelGroup>
Vou postar aqui como fuicou, caso alguém precise…
RADIO
<h:selectOneRadio id= "selCpfCnpj" style= "width:225px;" label= " ${ b [ 'comum.cpfcnpj' ] } "
value= "#{meuMB.cnpjCpf}" >
<f:selectItem itemLabel= " ${ b [ 'comum.cnpj' ] } " itemValue= "S" />
<f:selectItem itemLabel= " ${ b [ 'comum.cpf' ] } " itemValue= "N" />
<a4j:support event= "onclick"
ajaxSingle= "true"
reRender= "inputTextCnpjCpf"
action= "#{meuMB.doLimparCampoCnpjCpf}"/ >
</h:selectOneRadio>
INPUT
< h : panelGroup id = "inputTextCnpjCpf" >
< h : inputText id = "txtCnpj" label = "${b['comum.cpfcnpj']}" rendered = "#{meuMB.cnpjCpf == 'S'}"
value = "#{meuMB.object.cnpj}"
styleClass = "inputTexto"
converter = "CpfConverter"
validator = "CpfValidator"
style = "width:155px;"
disabled = "#{meuMB.desabilitaCampoCnpjCpf}" >
< rich : jQuery selector = "#txtCnpj"
timing = "onload"
query = "mask('99.999.999/9999-99')" />
</ h : inputText >
< h : inputText id = "txtCpf" label = "${b['comum.cpfcnpj']}" rendered = "#{meuMB.cnpjCpf == 'N'}"
value = "#{meuMB.object.cnpj}"
styleClass = "inputTexto"
converter = "CnpjConverter"
validator = "CnpjValidator"
style = "width:155px;"
disabled = "#{meuMB.desabilitaCampoCnpjCpf}" >
< rich : jQuery selector = "#txtCpf"
timing = "onload"
query = "mask('[CPF removido]')" />
</ h : inputText >
</ h : panelGroup >
[RESOLVIDO]