PDA

View Full Version : Can someone please help me with my not working javascript form



tazzy
02 Sep 2009, 09:15 AM
Can someone help me with the following? My javascript form doens't work the way it should. it doens;t give the errors I programmed and it doesn't send the form when it is filled in the way it should.

Maybe I made a mistake in the code because it's the first time I designed with java.

Thanks in advance.

here are the codes


<SCRIPT>
function Check("operationalleaseaanvraag") {
if (operationalleaseaanvraag.naam.value=="") {
alert(Uw naam is niet ingevuld!")
Operationalleaseaanvraag.naam.focus()
}
else {
if (operationalleaseaanvraag.e-mail.value=="") {
alert(Uw E-mail is niet ingevuld!")
Operationalleaseaanvraag.e-mail.focus()
}
else {
if (operationalleaseaanvraag.telefoonnummer.value=="") {
alert(Uw telefoonnummer is niet ingevuld!")
Operationalleaseaanvraag.telefoonnummer.focus()
}
else {
if (operationalleaseaanvraag.merk.value=="") {
alert(Het merk is niet ingevuld!")
Operationalleaseaanvraag.merk.focus()
}
else {
if (operationalleaseaanvraag.type.value=="") {
alert(Het type is niet ingevuld!")
Operationalleaseaanvraag.type.focus()
}
else {
if (operationalleaseaanvraag.bouwjaar.value=="") {
alert(Het bouwjaar is niet ingevuld!")
Operationalleaseaanvraag.bouwjaar.focus()
}
else {
if (operationalleaseaanvraag.leverdatum.value=="") {
alert(De leverdatum is niet ingevuld!")
Operationalleaseaanvraag.leverdatum.focus()
}
else {
if (operationalleaseaanvraag.leasebedrag.value=="") {
alert(Het leasebedrag is niet ingevuld!")
Operationalleaseaanvraag.leasebedrag.focus()
}
else {
if (operationalleaseaanvraag.looptijd.value=="") {
alert(De looptijd is niet ingevuld!")
Operationalleaseaanvraag.looptijd.focus()
}
else {
operationalleaseaanvraag.submit()}
}
</SCRIPT>

------------------------------------------------------------
<form name="operationalleaseaanvraag" method="post" action="mailto:test@test.nl" method="post" enctype="text/plain"><input type="hidden" name="subject" value="Operationalleaseaanvraag">

<div id="table"><table>
<tr><td colspan="3"><a href="automerken.htm">Klik hier om door de automerkencatalogus te bladeren</a></td></tr>
<tr><td>Naam (+ voorletters)</td><td colspan="2"><input type="text" name="naam"><td></tr>
<tr><td>Naam bedrijf</td><td colspan="2"><input type="text" name="naam bedrijf"><td></tr>
<tr><td>E-mail</td><td colspan="2"><input type="text" name="e-mail"><td></tr>
<tr><td>Adres</td><td colspan="2"><input type="text" name="adres"><td></tr>
<tr><td>Postcode</td><td colspan="2"><input type="text" name="postcode"><td></tr>
<tr><td>Plaats</td><td colspan="2"><input type="text" name="plaats"><td></tr>
<tr><td>Telefoonnummer</td><td colspan="2"><input type="text" name="telefoonnummer"><td></tr>
<tr><td>Directeur/Eigenaar</td><td colspan="2"><input type="text" name="Directeur"><td></tr>
<tr><td>Geboortedatum</td><td colspan="2"><input type="text" name="geboortedatum"><td></tr>
<tr><td>Inschrijfnummer KVK</td><td colspan="2"><input type="text" name="kvknummer"><td></tr>
<tr><td>Datum oprichting</td><td colspan="2"><input type="text" name="datum oprichting"><td></tr>
<tr><td>(Post-)Bankrekeningnummer</td><td colspan="2"><input type="text" name="Bankrekeningnummer"><td></tr>
<tr><td>Naam accountant</td><td colspan="2"><input type="text" name="accountant"><td></tr>
<tr><td>Telefoonnummer Accountant</td><td colspan="2"><input type="text" name="telaccountant"><td></tr>
<tr><td>Incl. of Excl Brandstof?</td><td><input type="radio" name="brandstof" value="Exclusief">Exclusief</td> <td><input type="radio" name="brandstof" value="inclusief">Inclusief</td> </tr>
<tr><td>Merk auto</td><td colspan="2"><input type="text" name="merk"><td></tr>
<tr><td>Type</td><td colspan="2"><input type="text" name="type"><td></tr>
<tr><td>Aantal deuren</td><td colspan="2"><input type="text" name="aantaldeuren"><td></tr>
<tr><td>Bouwjaar</td><td colspan="2"><input type="text" name="bouwjaar"><td></tr>
<tr><td>Leverdatum</td><td colspan="2"><input type="text" name="leverdatum"><td></tr>
<tr><td>Leverancier</td><td colspan="2"><input type="text" name="leverancier"><td></tr>
<tr><td>Aankoopprijs ex. BTW</td><td colspan="2"><input type="text" name="aankoopprijs"><td></tr>
<tr><td>Leasebedrag</td><td colspan="2"><input type="text" name="leasebedrag"><td></tr>
<tr><td>Looptijd</td><td colspan="2"><input type="text" name="looptijd"><td></tr>
<tr><td>Restwaarde</td><td colspan="2"><input type="text name="restwaarde"><td></tr>
<tr><td>Lease-Termijn</td><td colspan="2"><input type="text" name="leasetermijn"><td></tr>
<tr><td>Eigen inbreng</td><td colspan="2"><input type="text" name="eigeninbreng"><td></tr>
</table> </div><input type="button" value="verzenden" name="verzenden" OnClick="javascript:Check(operationalleaseaanvraag)"><input type="reset" value="reset" name="reset" OnClick="javascript: return confirm("weet u het zeker?")>

</form>
<br/>
<br/>

bradgreens
03 Oct 2009, 02:26 AM
Are your alerts missing proper quotes? Or is this a translation issue on the forum?

alert(Uw naam is niet ingevuld!")

--> missing first quote everywhere

alert("Uw naam is niet ingevuld!")