Hello..!

I just want to show an error message if user left text box blank. Here is my code on form.php, I really can find the problem...

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Your Valuable Suggestion</title>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>
<script type="text/javascript">
function notEmpty(elem, helperMsg){
    alert("Out");
    if(elem.value.length == 0){
        alert(helperMsg);
        elem.focus();
        return false;
    }
    return true;
}
</script>
</head>
<body id="main_body" >
<img id="top" src="top.png" alt="">
<div id="form_container">
<form id="form_453570" class="appnitro"  method="post" action="insertform.php">
  <div class="form_description">
    <ul >
      <li id="li_12" >
    <label class="description" for="element_12">First Name <font color="#EC0006">*</font> </label>
    <div>
    <input id="element_12" name="element_12" class="element text large" type="text" maxlength="255" value="" onblur="notEmpty(document.getElementById('element_12'), 'Please Enter a Value')"/> 
    </div> 
      </li>      
      <li id="li_13">
    <label class="description" for="element_13">Last Name <font color="#EC0006">*</font></label>
    <div>
    <input id="element_13" name="element_13" class="element text large" type="text" maxlength="255" value="" onblur="notEmpty(document.getElementById('element_13'), 'Please Enter a Value')"/> 
    </div> 
      </li>  
      <li class="buttons">
    <input type="hidden" name="form_id" value="453570" />
    <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
      </li>
    </ul>
</form>  
</body>
</html>

Thankyou for any advice or help

I found the issue...
If I remove this line <script type="text/javascript" src="view.js"></script> it works, now issue is I need this js file also. How can be it done?
See the effect of view.jsClick Here

And can download the view.js file for reference from here - Click Here

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.