Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
O formulário insere os registros na tabela mas não critica os campos. O código do formulário é esse: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Inserir livros na tabelas de livros</title><script language="javascript">
function validaForm() {
if (document.formLivro.txtCodigo.value.length <1)
{alert("O campo ISBN não pode ficar em branco. "). formLivro.txtCodigo.focus(). return false. }
if (document.formLivro.txtCodCategoria.value.length <1)formLivro.txtCodCategoria.focus(). return false. }{alert("O campo Título não pode ficar em branco."). formLivro.txtTitulo.focus(). return false. }
if (documento.formLivro.txtAutor.value.length <1)
{alert("Ocampo Autor não pode ficar em branco."). formLivro.txtAutor.focus(). return false. }
if (document.formLivro.txtPreco.value.length <1)formLivro.txtPreco.focus(). return false. }
if (document.formLivro.txtCapa.value.length <1)formLivro.txtCapa.focus(). return false
}
return true. }
</script>
</head>
<body>
<form name="formLivro" method="post" action="ResLab10_1.asp" onsubmit="return validaForm(this). ">
Inclusão de Livros<br /><br />
Informe os dados do livro a ser inserido. Os campos com (*) são de digitação obrigatória.<br /> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="20%">ISBN: </td>
<td width="80%"> <input name="txtCodigo" type="text" /> *</td>
</tr> <tr>
<td width="20%">Código da Categoria:</td>
<td width="80%"> <input type="text" name="txtCodCategoria" /> *</td>
</tr> <tr>
<td width="20%">Título:</td>
<td width="80%"> <input type="text" name="txtTitulo" /> *</td>
</tr> <tr>
<td width="20%">Autor:</td>
<td width="80%"> <input type="text" name="txtAutor" /> *</td>
</tr> <tr>
<td width="20%">Número de páginas:</td>
<td width="80%"> <input type="text" name="txtNPaginas" /></td>
</tr> <tr>
<td width="20%">Formato:</td>
<td width="80%"> <input type="text" name="txtFormato" /></td>
</tr> <tr>
<td width="20%">Preço:</td>
<td width="80%"> <input type="text" name="txtPreco" /> *</td>
</tr> <tr>
<td width="20%">Resenha:</td>
<td width="80%"> <textarea name="txtResenha" rows="5" cols="40"></textarea></td>
</tr> <tr>
<td width="20%">Lançamento (S/N): </td>
<td width="80%"> <input type="text" name="txtLancamento" /></td>
</tr> <tr>
<td width="20%">Data Publicação: </td>
<td width="80%"> <input type="text" name="txtDataPub" /></td>
</tr> <td width="20%"></td>
<td width="80%">
<input type="submit" value="Inserir" name="btInsere" />
<input type="reset" value="Limpa campos" name="btLimpa" />
</td>
</tr>
</table>
</form>
</body>
</html> O a página é essa: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html. charset=utf-8" />
<title>Inserindo dados em uma tabela</title>
</head> <body>
O Livro: "<strong><% = varTitulo %></strong>" foi cadastrado com sucesso
</body>
</html>Carregando comentários...