Avatar billede nyside Nybegynder
01. januar 2008 - 20:06 Der er 4 kommentarer og
2 løsninger

Fejl i Formmail

Hvem kan hjælpe??
Denne formmail eller hvad det hedder!
Jeg arbejder i Frontpage 2003 og jeg har andre (mindre antal felter)der virker sådan at alle felter skal være udfyldt ind man kan sende!!
Men jeg kan ikke finde fejlen.
Man må ikke kunne sende fommail før alle felter er udfyldt

her er siden
<html>



<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Main</title>
<base target="_self">

<style>
<!--
/*JavaScript Kit www.javascriptkit.com More scripts here*/
a{text-decoration:none}
.font5
    {color:black;
    font-size:8.0pt;
    font-weight:700;
    font-style:normal;
    text-decoration:none;
    font-family:Verdana, sans-serif;
    }
//-->
</style>
</script>
<style type="text/css">
a, a:visited {
    color: blue;
}
a:hover {
    color: black;
}
.postbody { font-size : 12px; line-height: 18px}
</style>
<body background="baggrund/sky_baggrund.jpg">
</head>
<body>
<script type="text/javascript">
function validering()
{
error = 0;



placering=0;
tekst=(document.forms[0].email.value).toLowerCase();
placering=tekst.indexOf("@");
if(tekst ==""){
alert ("Der skal stå en e-post adresse i tekst feltet, uden den kan du ikke sende formularen");
error = 1;
}
else{
tegn=tekst.indexOf(" ");
if(tegn!=-1){
alert ("Der må ikke være mellemrum i email adressen");
error = 1;
}
else{
if (tekst.indexOf("æ")!=-1 || tekst.indexOf("ø")!=-1 || tekst.indexOf("å")!=-1 ||
tekst.indexOf("Æ")!=-1 || tekst.indexOf("Ø")!=-1 || tekst.indexOf("Å")!=-1 ||
tekst.indexOf(";")!=-1 || tekst.indexOf(",")!=-1){
alert ("Der er ulovlige tegn i email adressen. Må ikke indeholde: æ ø å Æ Ø Å , ;");
error = 1;
}
else{
if (placering<1 || tekst.length<=(placering+1)){
alert ("e-post adressen er forkert - forsøg igen, uden den kan du ikke sende formularen");
error = 1;
}
}
}
}



if((document.forms[0].pilot.value=='') && (error==0))
{
alert('Du skal en skrive en pilot!');
document.forms[0].pilot.focus();
error = 1;
}



if((document.forms[0].land.value=='') && (error==0))
{
alert('Du skal skrive et land!');
document.forms[0].land.focus();
error = 1;
}



if((document.forms[0].model.value=='') && (error==0))
{
alert('Du skal skrive din model!');
document.forms[0].model.focus();
error = 1;
}



if((document.forms[0].laengde.value=='') && (error==0))
{
alert('Du skal skrive laengde!');
document.forms[0].laengde.focus();
error = 1;
}



if((document.forms[0].spaendvidde.value=='') && (error==0))
{
alert('Du skal skrive spaendvidde!');
document.forms[0].spaendvidde.focus();
error = 1;
}



if((document.forms[0].vaegt.value=='') && (error==0))
{
alert('Du skal skrive en vaegt!');
document.forms[0].vaegt.focus();
error = 1;
}



if((document.forms[0].understel.value=='') && (error==0))
{
alert('Du skal skrive hvilket understel!');
document.forms[0].understel.focus();
error = 1;
}



if((document.forms[0].fan.value=='') && (error==0))
{
alert('Du skal skrive hvilken fan!');
document.forms[0].fan.focus();
error = 1;
}



if((document.forms[0].motor.value=='') && (error==0))
{
alert('Du skal skrive hvilken motor!');
document.forms[0].motor.focus();
error = 1;
}



if((document.forms[0].regulator.value=='') && (error==0))
{
alert('Du skal skrive hvilken regulator!');
document.forms[0].regulator.focus();
error = 1;
}



if((document.forms[0].drivaccu.value=='') && (error==0))
{
alert('Du skal skrive hvilken drivaccu!');
document.forms[0].drivaccu.focus();
error = 1;
}



if((document.forms[0].watt.value=='') && (error==0))
{
alert('Du skal skrive hvormange watt!');
document.forms[0].watt.focus();
error = 1;
}



if((document.forms[0].modtagerakku.value=='') && (error==0))
{
alert('Du skal skrive hvilken modtager akku!');
document.forms[0].modtagerakku.focus();
error = 1;
}



if((document.forms[0].modtager.value=='') && (error==0))
{
alert('Du skal skrive hvilket modtager du bruger!');
document.forms[0].modtager.focus();
error = 1;
}



if((document.forms[0].campingstroem.value=='') && (error==0))
{
alert('Du skal skrive om du oensker campingstrøm!');
document.forms[0].campingstroem.focus();
error = 1;
}



if((document.forms[0].kommer.value=='') && (error==0))
{
alert('Du skal skrive hvor mange personer der kommer!');
document.forms[0].kommer.focus();
error = 1;
}



if((document.forms[0].loerdag.value=='') && (error==0))
{
alert('Du skal skrive hvor mange personer til spisning loerdag!');
document.forms[0].loerdag.focus();
error = 1;
}



if(error == 0)
document.forms[0].submit();
}



</script>
<FORM method="post" onsubmit="validering();return false;" action="http://www.minside.dk/cgi-bin/FormMail.pl">
<input type="hidden" name="recipient" value="mail@minside.dk">
<input type="hidden" name="subject" value="Deltager ved træf">
<input type="hidden" name="redirect" value="http://www.minside.dk/indbydelse.htm">
<table border="1" width="591" id="table1" style="border-width: 0px">
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">&nbsp;</td>
  <td width="398" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" colspan="2">
  <p align="center">&nbsp;</td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">&nbsp;</td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">&nbsp;</td>
  <td width="398" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" colspan="2">
  <p align="center"><b><font face="Arial" size="5">Deltager tilmeldings blanket</font></b></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">&nbsp;</td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">&nbsp;</td>
  <td width="398" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" colspan="2">
  <p align="center"><b><font size="2">Udfyld alle rubrikker og klik på send</font></b></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">&nbsp;</td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">&nbsp;</td>
  <td width="398" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" colspan="2">&nbsp;</td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">&nbsp;</td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Pilot</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="pilot" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Land</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="land" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Model</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="model" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Længde</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="laengde" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
</tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Spændvidde</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="spaendvidde" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Vægt</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="vaegt" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Understel</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="understel" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Fan</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="fan" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Motor</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="motor" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Regulator</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="regulator" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Driv Akku</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="driv_akku" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Watt</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="watt" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Modtager Akku</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="modtager_akku" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Modtager</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="modtager" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#C0C0C0">&nbsp;</td>
  <td width="398" style="border-style: none; border-width: medium" bgcolor="#C0C0C0" colspan="2">&nbsp;</td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#C0C0C0">&nbsp;</td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Camping Strøm</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="campingstrom" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
</tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <b><font face="Arial" size="2">Antal personer kommer</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="antal_personer" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  &nbsp;</td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#C0C0C0">&nbsp;</td>
  <td width="398" style="border-style: none; border-width: medium" bgcolor="#C0C0C0" colspan="2">&nbsp;</td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#C0C0C0">&nbsp;</td>
    </tr>
    <tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b><font face="Arial" size="2">Spisning antal pers.</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="spisning_antal_pers" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
    </tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
    <b>
  <font face="Arial" size="2">Email</font></b></td>
  <td width="398" style="border-style: none; border-width: medium" colspan="2">
<font size="1">
<textarea name="email" rows="1" cols="45"></textarea></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2">
  <font color="#FF3300">*</font></td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium" height="20">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">&nbsp;</td>
  <td width="398" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" colspan="2" height="20">
&nbsp;</td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">&nbsp;</td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">&nbsp;</td>
  <td width="76" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">
<p align="center">
<font size="1"><input type="submit" value="Send"></font></td>
  <td width="291" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">
<p align="center"><font size="2">&nbsp; </font> <font size="1"><input type="reset" value="Nulstil"></font></td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">&nbsp;</td>
</tr>
<tr>
  <td width="14" style="border-style: none; border-width: medium">&nbsp;</td>
  <td width="173" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">&nbsp;</td>
  <td width="76" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">
<p align="center">&nbsp;</td>
  <td width="291" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">
<p align="center">&nbsp;</td>
  <td width="23" style="border-style: none; border-width: medium" bgcolor="#E2E2E2" height="20">&nbsp;</td>
</tr>
</table>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>



</html>
Avatar billede w13 Novice
01. januar 2008 - 20:39 #1
Prøv evt. at rette:
  onsubmit="validering();return false;"
til:
  onsubmit="validering()"

og:
  if(error == 0)
  document.forms[0].submit();
til:
  if(!error)return true;
  if(error>0)return false;
Avatar billede nyside Nybegynder
01. januar 2008 - 20:59 #2
Hej w13
det hjalp ikke!
den kan stadig sendes unden at felterne er udfyldt
Avatar billede w13 Novice
02. januar 2008 - 01:12 #3
Men ser du popup'erne, inden den submitter?
Avatar billede nyside Nybegynder
02. januar 2008 - 09:07 #4
Ja , men kun om at udfylde email
og der går den afsted uden noget i felterne
Avatar billede w13 Novice
02. januar 2008 - 14:16 #5
Ok, nu har jeg fundet fejlen. Den nåede simpelthen aldrig ned til den del, der afgør, om den skal lade være med at submitte.

Ret som jeg sagde før:
  onsubmit="validering();return false;"
til:
  onsubmit="return validering()"

og:
  if(error == 0)
  document.forms[0].submit();
til:
  if(!error)return true;
  return false;

Og så skal du gå din javascript-kode igennem. Jeg kan nemlig se, at du f.eks. skriver:
drivaccu når feltet i HTML-koden hedder driv_akku
modtagerakku når feltet hedder modtager_akku
campingstroem når feltet hedder campingstrom
kommer når feltet hedder antal_personer
loerdag når feltet hedder spisning_antal_pers

Og så gi'r det jo ret god mening, at scriptet ikke kan finde ud af det. =)
Avatar billede w13 Novice
15. januar 2008 - 12:51 #6
Takker for point!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester