Problema na validação

0 respostas
M

Pessoal,
seguinte, tenho um formulario que a principio se por ventura o usuario deixar algum campo em branco ele não deixa vc continuar enquanto vc n preencher ele. Porém, o problema esta quando vc altera ele. Se vc deixar em branco ele informa q o campo ta em branco só que não espera nem vc corrigir, ele altera os dados.

Segue o codigo jsp:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<link href="css/gip_style.css" rel="stylesheet" type="text/css"/>

<script language="javascript" src="js/agendamento.js"></script>
<script language="javascript" src="js/funcoes.js"></script>
<body>
    <script type="text/javascript">
        setTimeout("Mudou()",100);
    </script>
    <div id="conteudoAgendamento">
        <s:form name="form1" id="form1" theme="simple" action="agendamento_salvarConfirmacao.action">
            <s:hidden id="solicitanteAtual.id" name="solicitanteAtual.id"></s:hidden>
            <s:hidden id="agendamento.id" name="confirmacao.agendamento.id"></s:hidden>
            <s:hidden id="confirmacao.id" name="confirmacao.id"></s:hidden>
            <s:hidden id="horaExtra.id" name="horaExtra.id"></s:hidden>
            <s:hidden id="acao" name="acao"></s:hidden>
            <s:hidden id="dataSelecionada" name="dataSelecionada"></s:hidden>
            <div id="editAgendamento">
                <table id="Table1" cellspacing="0" cellpadding="2" border="0" width="100%">
                    <tr>
                        <td nowrap="nowrap" align="Left" colspan="2" height="30px">
                            <b>Solicitante:</b>&nbsp;&nbsp;<s:property value="solicitanteAtual.login"></s:property>&nbsp;-&nbsp;<s:property value="solicitanteAtual.nome"></s:property>
                        </td>
                    </tr>
                    <tr>
                        <td nowrap="nowrap" align="Left" height="30px">
                            Usuário:
                        </td>
                        <td nowrap="nowrap" align="Left" height="30px">
                            <s:select id="cboUsuario"
                                      list="usuarios"
                                      listValue="login+' - '+nome"
                                      name="confirmacao.agendamento.usuario.id"
                                      headerKey="0"
                                      listKey="id"
                                      headerValue="Selecione o usuário...">
                            </s:select>
                        </td>
                    </tr>
                    <tr>
                        <td nowrap="nowrap" align="Left" height="30px">
                            Tipo de Deslocamento:
                        </td>
                        <td nowrap="nowrap" align="Left" height="30px">
                            <s:select id="cboTipoDesloc"
                                      list="tiposDeslocamento"
                                      listValue="descricao"
                                      name="confirmacao.agendamento.tipoDeslocamento.id"
                                      headerKey="0"
                                      listKey="id"
                                      cssStyle="width:300px;"
                                      headerValue="Selecione o deslocamento...">
                            </s:select>
                        </td>
                    </tr>
                    <tr>
                        <td nowrap="nowrap" align="Left" height="30px">
                            Motivo:
                        </td>
                        <td nowrap="nowrap" align="Left" height="30px">
                            <s:textarea id="areMotivo"
                                        name="confirmacao.agendamento.motivo"
                                        rows="3"
                                        cssStyle="width:465px;"
                                        readonly="true">
                            </s:textarea>
                        </td>
                    </tr>
                </table>
                <table id="Table1" cellspacing="0" cellpadding="2" border="0" width="50%">
                    <tr>
                        <td nowrap="nowrap" height="30px">
                            Data Agendamento (dd/mm/aaaa):
                        </td>
                        <td height="30px">
                            <s:textfield id="txtDataInicio"
                                         name="dataSelecionada"
                                         onkeypress="formatar(this, '##/##/####')"
                                         onkeyup="somente_numero(this)"
                                         onblur="validarData(this,'False')"
                                         maxlength="10"
                                         id="txtDataInicio"
                                         title="Digite apenas números (Não digite as "/")."
                                         cssStyle="width:70px;"
                                         disabled="true">

                            </s:textfield>
                        </td>
                        <td>&nbsp;&nbsp;&nbsp;</td>
                        <td nowrap="nowrap" height="30px">
                            Hora Início (hh:mm):
                        </td>
                        <td height="30px">
                            <s:textfield id="txtHoraInicio"
                                         name="horaAuxiliar"
                                         maxLength="5"
                                         onkeypress="formatar(this,'##:##')"
                                         onkeyup="somente_numero(this)"
                                         onblur="validarHora(this,'False')"
                                         maxlength="5"
                                         id="txtHoraInicio"
                                         title="Digite apenas números (Não digite os ":")."
                                         cssStyle="width:40px;"
                                         readonly="true">
                            </s:textfield>
                        </td>
                    </tr>
                </table>
                <br>
                <table id="Table1" cellspacing="0" cellpadding="2" border="0" width="100%">
                    <tr>
                        <td nowrap="nowrap">
                            Quant. pessoas (máx. 4):&nbsp;&nbsp;
                        </td>
                        <td nowrap="nowrap">
                            <s:textfield id="txtQtdPessoas" name="confirmacao.agendamento.quantidadePassageiros" maxlength="10"  title="Máximo de 4 pessoas!" size="1" cssStyle="text-align:center" readonly="true">
                            </s:textfield>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            Transp. equipamentos:&nbsp;&nbsp;Sim
                            <input type="radio"
                                   <s:if test="%{confirmacao.agendamento.equipamento == true}">
                                       checked
                                   </s:if>
                                   value="true"
                                   id="rdbTranspEquipSim"
                                   name="confirmacao.agendamento.equipamento"
                                   onclick="javascript:Mudou()">

                            &nbsp;&nbsp;Não
                            <input type="radio"
                                   <s:if test="%{confirmacao.agendamento.equipamento == false}">
                                       checked
                                   </s:if>
                                   value="false"
                                   id="rdbTranspEquipNao"
                                   name="confirmacao.agendamento.equipamento"
                                   onclick="javascript:Mudou()">


                        </td>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr id="linha">
                        <td id="DescriEquip" nowrap="nowrap" align="Left" height="30px">
                            Descrição equipamentos:
                        </td>
                        <td nowrap="nowrap" align="Left">
                            <s:textarea id="areDescEquip" name="confirmacao.agendamento.descricaoEquipamento" rows="3" cssStyle="width:430px;">
                            </s:textarea>
                        </td>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                        <td nowrap="nowrap" style="background-color:#D1E0EB;border-style:None;">
                            Origem:
                        </td>
                        <td nowrap="nowrap" style="background-color:#D1E0EB;border-style:None;">
                            <s:select id="cboOrigem"
                                      name="confirmacao.agendamento.origem"
                                      list="unidades"
                                      listValue="cgc+' - '+sigla"
                                      listKey="nome"
                                      headerKey="0"
                                      headerValue="Selecione a origem..."
                                      cssStyle="background-color:#C2D5ED; width:250px;">
                            </s:select>
                        </td>
                    </tr>
                    <tr>
                        <td nowrap="nowrap" colspan="2" style="height:4px;">
                        </td>
                    </tr>
                    <tr>
                        <td nowrap="nowrap" style="background-color:#E6F5FF;">
                            Destino:
                        </td>
                        <td nowrap="nowrap" style="background-color:#E6F5FF;">
                            <s:select id="cboDestino"
                                      name="confirmacao.agendamento.destino"
                                      list="unidades"
                                      listValue="cgc+' - '+sigla"
                                      listKey="nome"
                                      headerKey="0"
                                      headerValue="Selecione o destino..."
                                      cssStyle="background-color:#D2EEF7; width:250px;">
                            </s:select>
                        </td>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                        <td nowrap="nowrap" align="Left" height="30px">
                            Itinerário:
                        </td>
                        <td nowrap="nowrap" align="Left" height="30px">
                            <s:textarea id="areIntinerario" name="confirmacao.agendamento.etinerario" rows="3" cssStyle="width:430px;">
                            </s:textarea>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">&nbsp;</td>
                    </tr>
                </table>
            </div>
            <s:if test="%{confirmacao.agendamento.permissaoEdicao == true}">
                <div id="divConfirmarProgramacao">
                    <table id="tableConfirmarAgendamento" border="0">
                        <tr>
                            <td colspan="2" style="font-weight:bold;">
                                Confirmação/Complemento de informações
                            </td>
                        </tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr>
                            <td style="font-weight:bold;">
                                Carro:
                            </td>
                            <td>
                                <s:select id="CboCarros"
                                          name="carro.id"
                                          list="carros"
                                          listValue="modelo"
                                          listKey="id"
                                          headerKey="0"
                                          headerValue="Selecione o carro..."
                                          cssStyle="width:250px;"
                                          onchange="MudouCarro();" >
                                </s:select>
                            </td>
                        </tr>
                    </table>
                    <div id="divTaxi" <s:if test="%{carro != null && carro.id == 1}"> style="display:block" </s:if>>
                        <table id="tableDivTaxi">
                            <tr>
                                <td colspan="2" style="font-weight:bold;">
                                    Para Táxi
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Recibo:
                                </td>
                                <td nowrap="nowrap" align="Left">
                                    <input id="txtReciboInicial" name="txtReciboInicial" type="text" maxlength="9" size="12" onkeypress="return filtroCaracteres(event,'[telefone removido]')"/>&nbsp;
                                    <input id="btnIncluirRec" type="button" onclick="IncluirRec()" Class="BTN" value="Incluir" style='WIDTH:50px;'>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input id="btnExcluirRec" type="button" onclick="DelItemRecibo()" Class="BTN" value="Excluir">
                                </td>
                                <td nowrap="nowrap" align="Left">
                                    <s:select id="lstRecibos"
                                              name="reciboTaxi.numeroRecibo"
                                              list="recibos"
                                              listKey="id"
                                              listValue="numeroRecibo"
                                              multiple="true"
                                              cssStyle="height:90px;width:136px;">
                                    </s:select>
                                    <input id="copiaLstRecibos" name="copiaLstRecibos" type="text" maxlength="400" style="display:none" />
                                    <!--s:select list="recibos" listKey="id" listValue="nome" id="naoSelecionados" name="naoSelecionados" multiple="true" size="10"/-->
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="divCarros" <s:if test="%{carro != null && carro.id != 1}">style="display:block" </s:if>>
                        <table id="tableDivCarros">
                            <tr>
                                <td colspan="2" style="font-weight:bold;">
                                    Para carros
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Qtd. horas Extras:
                                </td>
                                <td nowrap="nowrap" align="Left">
                                    <s:textfield id="txtQtdHExtras"
                                                 name="horaExtra.quantidadeHoras"
                                                 maxLength="5"
                                                 onkeypress="formatar(this,'##:##')"
                                                 onkeyup="somente_numero(this)"
                                                 onblur="validarHora(this,'False')"
                                                 maxlength="5"
                                                 title="Digite apenas números (Não digite os ":")."
                                                 cssStyle="width:40px;">
                                    </s:textfield>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Motorista:
                                </td>
                                <td nowrap="nowrap" align="Left">
                                    <s:select id="cboMotorista"
                                              name="equipeInterna.id"
                                              list="motoristas"
                                              listValue="nome"
                                              listKey="id"
                                              headerKey="0"
                                              headerValue="Selecione o motorista...">
                                    </s:select>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </s:if>
            <div id="divBotoes">
                <table id="tableButton" width="100%" border="0">
                    <tr id="LinhaBotao">
                        <td align="right">
                            <input
                                type="button"
                                value="Salvar"
                                Title="Salvar"
                                onclick="funValidar();funValidarConfirmacao()"
                                style="width: 100px;cursor: hand;"
                                class="BTNADD">
                        </td>
                        <s:if test="%{confirmacao.id == null}">
                            <s:if test="%{confirmacao.agendamento.reciboTaxis.size == 0}">
                                <td align="right" width="100px">
                                    <input
                                        type="button"
                                        value="Excluir"
                                        Title="Excluir"
                                        onclick="deletar('${confirmacao.agendamento.id}');"
                                        style='WIDTH: 100px;CURSOR: pointer;'
                                        class="BTNDELAG"/>
                                </td>
                            </s:if>
                        </s:if>
                        <td align="right" width="100px">
                            <!--s:submit targets="principal" value="Excluir" cssStyle="width:100px; cursor:hand;" cssClass="BTNDEL">/s:submit-->
                            <input
                                type="button"
                                value="Cancelar"
                                Title="Cancelar"
                                onclick="window.location='<s:text name="agendamento_filtrar.action"/>'"
                                class="BTNADD"/>
                        </td>
                    </tr>
                </table>
            </div>              
        </s:form>
    </div>
Criado 13 de janeiro de 2010
Respostas 0
Participantes 1