0

Hello! I've a Javascript function that has to verify if a form field is empty or not. My function works fine on my local server (Vertrigo), but when I upload it on server (online), the function doesn't verify if form fields are empty or not. Please help, I'm not good in Javascript. Thanks.

<head>
<script type="text/javascript" language="JavaScript">
function empty()
{if ( document.form.nume.value == '' )    
       {alert('ATENTIE! Introduceti numele!')    
        return false;}
if ( document.form.str1.value == '' )    
       {alert('ATENTIE! Introduceti strada!')    
        return false;}
if ( document.form.tel1.value == '' )    
        {alert('ATENTIE! Introduceti numarul de telefon pentru contact!')    
        return false;}
if ( document.form.loc1.value == '' )    
        {alert('ATENTIE! Introduceti localitatea!')    
        return false;}
if ( document.form.jud1.value == '' )    
        {alert('ATENTIE! Introduceti judetul!')    
        return false;}

return true;}

</script></head>

.... and function call...

<form action="contcomp.php" method="POST" name="form" onSubmit="return empty();">

Edited by monicao: n/a

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by monicao
0

I've solved my problem, I missed some ; in function syntax. Good luck all!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.