Ejemplo práctico de como usar jQuery en ADF, en este caso como cambiar el type de un inputText para el caso de querer mostrar los caracteres de un campo contraseña.
<af:resource type="javascript"
source="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"/>
<af:resource type="javascript">
function showPasswordMethod(e) {
var inputPassword1 = $("input[id*=it2]")[0];
if (inputPassword1.type == "text") {
inputPassword1.type = "password";
$("img[id*=imgShowPassword]")[0].src = "/webcenter/../wcstatic/img/genericas/eye_black.png";
}
else {
inputPassword1.type = "text";
$("img[id*=imgShowPassword]")[0].src = "/webcenter/../wcstatic/img/genericas/eye_red.png";
}
}
</af:resource>
<af:inputText label="Contraseña actual" id="it2" required="true" styleClass="resetPasswordField oldpwd" value="#{resetPasswordBean.oldpassword}"
secret="true" autoComplete="off"/>
<af:image source="/../wcstatic/img/genericas/eye_black.png" id="imgShowPassword" inlineStyle="position: absolute;bottom: 190px; right: 14px; cursor: pointer;">
<af:clientListener method="showPasswordMethod" type="click"/>
</af:image>
No hay comentarios:
Publicar un comentario