Jump to content
Fórum Script Brasil
  • 0

Formulários


Flavia Soul

Question

3 answers to this question

Recommended Posts

  • 0

<script>

function verify()

{

for (i = 0; i < form1.length; i++)

  if (form1.elements.value.length == 0)

  {alert("Por favor, preencha o(s) campo(s) em branco!")

  return(false)}

  return(true)

}

</script>

na tag form você coloca isso:

<form name="form1" method="post" action="*.php" onSubmit="return(verify())">

Link to comment
Share on other sites

  • 0

Seria algo mais ou menos assim:

function verificaCampo() {
   if (nomeForm.nomeCampo.value == "") {
      alert("Preencha o campo X");
      return false;
   }
   return true;
}

Você pode mandar o nome do form via parâmetro, assim como o nome do campo, Ou deixar "engessado" assim mesmo, se o form for pequeno.

Espero que funcione e te ajude!

Até mais,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...