FernandoCartaxo 8 de jun. de 2009
robinsonbsilva 8 de jun. de 2009
Segue os js. 8)
& lt ; script type = "text/javascript" & gt ;
function exibe ( id ) {
if ( document . getElementById ( id ). style . display == "none" ) {
document . getElementById ( id ). style . display = "inline" ;
}
else {
document . getElementById ( id ). style . display = "none" ;
}
}
& lt ; / script & gt ;
Pior que passo o nome da DIV corretamente, não sei se essas tags do struts podem estar causando…
Marlon_Meneses 8 de jun. de 2009
guimoz:
if(document.getElementById(id).style.display== "none") {
n deveria ser
if ( document .getElementById ( id ) .style .display = "none" ) {
…??
não
== (igualdade)
= (atribuição)
Marlon_Meneses 8 de jun. de 2009
onde está o componente que chama essa ação?
e o script está dentro da tag do cabeçalho (header)?
robinsonbsilva 8 de jun. de 2009
Então o componente que chama essa função é um “select” no evento onclick.
O script está no header sim!
< html:select property="idPerfil" styleId = "idPerfil" value='${ dto . perfil . idPerfil } ' onclick="exibe('gridEmail');">
< html:option value="-1"> Selecione uma opçã o< /html:option>
< html:options collection="listPerfis" property="idPerfil" labelProperty="nome"/>
< /html:select>
Marlon_Meneses 8 de jun. de 2009
cara…
pelo jeito tá tudo certim…
rsrs
eu acho que deve ser o seguinte
no jsf, os id’s de alguns componentes mudam quando dentro de algum outro componente como h:form
por exemplo se vc tiver um form com o id = “formulario” e o h:inputText com o id=“texto” então na renderização o framework vai interpretar e colocar assim
h:inputText id=“formulario:texto” mas eu não sei se isso acontece com componentes html puro
verifique se não é isso que está acontecendo
robinsonbsilva 8 de jun. de 2009
Com certeza é algo referente ao <html:form>, as tags do struts devem estar mudando a identificação.
Pior que não tenho a menor idéia de como referenciar esse <div>, já que no código fonte aparece o
<div id="nomeDadoPorMim"> .... <div>
Renato_Ceadareanu 8 de jun. de 2009
Faz um teste disso sem ser com JSF
Até
robinsonbsilva 8 de jun. de 2009
[size=7]
Senhores(as)
Muito estranho, não mudei nada e agora foi!!!! Segue o js e parte do jsp.
& lt ; script language = "JavaScript" type = "text/javascript" & gt ;
function doExibition ( value ){
alert ( value );
if ( value == 1 ){
document . getElementById ( 'gridCodigo' ) . style . display = "none" ;
document . getElementById ( 'gridEmail' ) . style . display = "inline" ;
} else if ( value == 2 ){
document . getElementById ( 'gridCodigo' ) . style . display = "none" ;
document . getElementById ( 'gridEmail' ) . style . display = "inline" ;
} else if ( value == 3 ){
document . getElementById ( 'gridCodigo' ) . style . display = "inline" ;
document . getElementById ( 'gridEmail' ) . style . display = "none" ;
}
}
& lt ; / script & gt ;
& lt ; html : form action = "/undertaker/funcionario.do?method=doConfirm" focus = "nome" styleId = "searchform" & gt ;
& lt ; input name = "action" id = "action" type = "hidden" value = "<%=action%>" & gt ;
& lt ; input name = "idFuncionario" id = "idFuncionario" type = "hidden" value = '<bean:write name="dto" property="idFuncionario"/>' & gt ;
& lt ; div id = "div_form" & gt ;
& lt ; div class = "div_contrato" & gt ; Nome : & lt ; / div & gt ;
& lt ; div class = "div_txt_contrato" & gt ;
& lt ; input type = "text" name = "nome" id = "nome" class = "textbox" value = '<bean:write name="dto" property="nome"/>' & gt ;
& lt ; / div & gt ;
& lt ; div class = "div_contrato" & gt ; Perfil : & lt ; / div & gt ;
& lt ; div class = "div_txt_contrato" & gt ;
& lt ; html : select property = "idPerfil" styleId = "idPerfil" value = '${dto.perfil.idPerfil}' onchange = "doExibition(idPerfil.value);" & gt ;
& lt ; html : option value = "-1" & gt ; Selecione uma op & ccedil ; & atilde ; o & lt ; / html : option & gt ;
& lt ; html : options collection = "listPerfis" property = "idPerfil" labelProperty = "nome" /& gt ;
& lt ; / html : select & gt ;
& lt ; / div & gt ;
& lt ; div id = "gridCodigo" style = "display:none" & gt ;
& lt ; div class = "div_contrato" & gt ; Código Vendedor : & lt ; / div & gt ;
& lt ; div class = "div_txt_contrato" & gt ;
& lt ; input type = "text" name = "idCorretora" id = "idCorretora" class = "textbox" value = '<bean:write name="dto" property="idCorretora"/>' & gt ;
& lt ; / div & gt ;
& lt ; / div & gt ;
& lt ; div id = "gridEmail" style = "display:none" & gt ;
& lt ; div class = "div_contrato" & gt ; Email : & lt ; / div & gt ;
& lt ; div class = "div_txt_contrato" & gt ;
& lt ; input type = "text" name = "email" id = "email" class = "textbox" value = '<bean:write name="dto" property="email"/>' & gt ;
& lt ; / div & gt ;
& lt ; / div & gt ;
& lt ; div class = "div_contrato" & gt ; Senha : & lt ; / div & gt ;
& lt ; div class = "div_txt_contrato" & gt ;
& lt ; input type = "password" name = "senha" id = "senha" class = "textbox" value = '<bean:write name="dto" property="senha"/>' & gt ;
& lt ; / div & gt ;
& lt ; div class = "div_bto_contrato" & gt ;
& lt ; input type = "submit" name = "gravar" value = "Gravar" class = "button" /& gt ;
& lt ; input type = "reset" name = "Voltar" value = "Voltar" class = "button" onClick = "doBack();" & gt ;
& lt ; / div & gt ;
& lt ; / div & gt ;
& lt ; / html : form & gt ;
[/size]
Renato_Ceadareanu 8 de jun. de 2009
Putz… puxa da memória q alguma coisa vc alterou!! rs
Mas o importante é q funcionou!!