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.

<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;}


.... and function call...

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.