Thanks to you Michael,
I solved the problem including "return true" before submitting the form
Siomara
<html>
<head>
<title>Inclui/Altera Marca Propriedade</title>
<script language="javascript">
////////////////////////////////////////////////////////////////////////////
/
// Set focus to the first form element
//
function focusFirst()
{
document.all("txtDescricao").focus();
}
////////////////////////////////////////////////////////////////////////////
///
// Validate fields and submit form elements to servlet
RegistraMarcaPropriedade
//
function doFormSubmit()
{
objfrm=document.incluiAlteraMarcaPropriedade;
//Store the file path of the next servlet/jsp to be called
strFilePath = "/Sisc/servlet/RegistraMarcaPropriedade"
strDescricao=objfrm.txtDescricao.value;
if(isSpecialChar(strDescricao) || !isChar(strDescricao))
{
alert("Favor entrar com uma descrição válida.");
objfrm.txtDescricao.focus();
return false;
}
if(isEmpty(strDescricao))
{
alert("Campo obrigatório");
objfrm.TxtNumber.focus();
return false;
}
objfrm.method="post";
objfrm.action=strFilePath;
return true; ( I JUST INCLUDED THIS LINE TO MY CODE)
objfrm.submit();
}
////////////////////////////////////////////////////////////////////////////
///
// Clean all the fields
//
function doClearForm()
{
for(i=0;i<document.inputFormSearch.elements.length-1;i++)
{
if(document.inputFormSearch.elements[i].type=="text")
document.inputFormSearch.elements[i].value="";
}
document.all("txtDescricao").focus();
return false;
}
////////////////////////////////////////////////////////////////////////////
///
// Checks whether the form input element is empty
//
function isEmpty(formelem)
{
expisEmpty=/[^ ]/
return ! expisEmpty.test(formelem);
}
////////////////////////////////////////////////////////////////////////////
///
// Checks whether the form input element is numeric
//
function isNumeric(formelem)
{
var expisNumeric=/[a-zA-Z\*\~|@\$\%\^\&\*\(\)\#\!\`\-\+\=\.\,\?]/
return ! expisNumeric.test(formelem)
}
////////////////////////////////////////////////////////////////////////////
///
// Checks whether the form input element is a String
//
function isChar(formelem)
{
var expisChar=/[0-9]/;
return ! expisChar.test(formelem);
}
////////////////////////////////////////////////////////////////////////////
///
//Checks whether the form input element contains any Special Characters or
not.
//
function isSpecialChar(formelem)
{
var expisSpecialChar=/[\&\;\"\*\~\|[EMAIL PROTECTED]<\>\\\+\=\?]/
return expisSpecialChar.test(formelem)
}
</script>
</head>
<body onload="javascript:focusfirst()">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" bordercolor="#111111" width="100%">
<tr>
<td width="100%" colspan="3">
<img border="0" src="images/bannerPR.jpg" width="763" height="21"></td>
</tr>
<tr>
<td width="18%">
<b>
<font color="#008080" size="5">SISNAC</font><font color="#008000"
size="5"> </font>
</b></td>
<td width="59%">
<p align="center"><font size="4"><b>Cadastramento de Nova Marca de
Propriedade</b></font></td>
<td width="23%">
</td>
</tr>
<tr>
<td width="18%">
</td>
<td width="82%" colspan="2" align="right">
</td>
</tr>
<tr>
<td width="100%" colspan="3">
<p align="center"> </p>
<form name="incluiAlteraMarcaPropriedade">
<p align="left"> Marca de Propriedade:
<input type="text" name="txtDescricao" size="66"></p>
<p align="center">
<input type="submit" value="Enviar" name="btnSubmit" onclick="
javascript:return
doFormSubmit()">
<input type="reset" value="Apagar" name="btnApagar"></p>
</form>
<p align="center"> </p>
<p align="center"> </p>
</td>
</tr>
<tr>
<td width="100%" colspan="3"> </td>
</tr>
</table>
</body>
</html>
THis is my database now:
SQL> select * from marcapropriedade;
IDMARCAPROPRIEDADE DESCRICAO
------------------ ------------------------------
1 Acordos Internacionais
2 Adm Pública Federal
3 Defesa
4 Mercosul
5 just a test
6 one more test
6 linhas selecionadas.
-----Mensagem original-----
De: Michael Jouravlev [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 30 de junho de 2006 18:52
Para: Tomcat Users List
Assunto: Re: problem with doPost method - executed twice
If you submit the form from form.onsubmit, return false to tell
browser that the form has already been submitted. This is Javascript,
not a Tomcat issue.
On 6/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have not received any reply regarding the issue bellow. Please, any help
> is MORE THAN WELCOME.
>
> I also can´t see if my messages are reaching everybody correctly since I
get
> no copy of it when I post.
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]