0
I need to insert in my JSP a function that cleans the input value when the user clicks to enter the value, but I cannot enter class in the input, nor is Placeholder and nor Onclick accepted, could someone tell me some way to do?
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<SCRIPT>
function verificarEEnviar()
{
var dsEmail=document.captacaoEmailsForm["dsEmail"].value;
var atpos=dsEmail.indexOf("@");
var dotpos=dsEmail.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=dsEmail.length)
{
alert("Não é um endereço de e-mail válido");
}
else{
return document.captacaoEmailsForm.submit();
}
document.captacaoEmailsForm.reset();
}
</SCRIPT>
<div class="captacao">
<html:form action="/captacaoEmails" styleId="cadastroCliente2">
<div class="captacao-titulo">Cadastre-se e receba<span> ofertas exclusivas </span> </div>
<div class="captacao-email">
<html:text tabindex="5" property="dsEmail" maxlength="60" onClick="this.form.reset()" value="inserir seu email" />
<a href="javascript:verificarEEnviar();" id="btContinuar" class="captacao fr">Enviar</a>
<br>
<html:errors property="dsEmail" header="empty"/>
</div>
</html:form>
</div>
It has a calling function reset could not use it? As soon as it clicks , its action inserts and gives the command in the input.
– Marcos Vinicius
I can use the reset, but later I have to use an Onclick to activate the function in the field, no?
– CRAJ