【问题标题】:HTML disappears after submit提交后HTML消失
【发布时间】:2012-12-14 19:13:04
【问题描述】:

我有这个表格:

<div id="tudo">
    <div id="sige">
        <div id="voltar_sair">
                    <a href="ServletListarEventosInscricoesAbertas.do" id="voltar">Voltar</a>
        </div>
        <h1>SIGE - Sistema de Gerenciamento de Eventos </h1>
            <form name="form" method="post" action="" id="sige">
                <input type="hidden" name="codigoEvento" value="<%=codigoEvento%>">
                <input type="hidden" name="tela" value="<%=tela%>"> <input
                    type="hidden" id="hidden" value="<%=cpf%>">

                <fieldset>
                    <legend>Consultar Eventos do Participante</legend>
                    <p>
                        <label for="cpf">CPF:</label> <input id="cpf" name="cpf" class="mascara-cpf" type="text" onblur="if(this.value != ''){ValidarCPF(this);}" value="<%=cpf%>"/>
                    </p>

                </fieldset>

                <p>
                    <input class="botoes_form" value="Consultar" id="reemitir" type="button" onClick="javascript:consultarEventosParticipante()"/>
                    <input class="botoes_form" value="Limpar" id="limpar" type="reset" onclick="$('#cpf').val()"/>
                </p>

并且,提交表单后,带有标签和输入(文本)的整个 p 消失了。

我能做些什么来解决这个问题?

编辑:

function consultarEventosParticipante(){

    if(document.form.cpf.value == ""){
        alert("Por favor, digite o campo C.P.F.");
        return;
    }
    document.form.action="ServletInicioConsultarEventosParticipante";
    document.form.submit();
}

【问题讨论】:

  • consultarEventosParticipant() 可能正在这样做。您没有包含此代码,所以我只能猜测。
  • 不是清空整个页面吗?因为表单提交了?
  • 我为您格式化了您的代码。请不要提交丑陋的无格式代码
  • servlet 返回到这个页面。它显示了该表格下方的表格。所以如果用户想再次咨询,输入就消失了。

标签: java html jsp servlets


【解决方案1】:

显然问题已经解决了。我将表单标签放在字段集中,问题就消失了。我不明白它的原因,但这是修复错误的方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多