WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design Click here to Update Your Picture
Rupali Gulande
Date : Jul 09th 2007
Grade : 3 of 5 (graded 5 times)
Viewed : 9929
File : 4668.zip
Images : Image 1
Search : More code by Rupali Gulande
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

In this short code we are going to process a user form. and going to show an error message and change the color of a field name by using javascript.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Form Processing : with alert Highlight field name which is not filled by user</title>
<script language="javascript" type="text/javascript">
function CheckTheForm() {
    var result = true;
    var msg="";
       
    if (document.frmTest.name.value=="") {
        msg+="Please enter Name! \n";
        document.frmTest.name.focus();
        document.getElementById('title').style.color="red";
        result = false;
       
    }
    if (document.frmTest.eml.value=="") {
            msg+="Email is Required!\n";
            document.frmTest.eml.focus();
            document.getElementById('eml').style.color="red";
            result = false;
            }
   

    if(msg==""){
    return result;
    }{
    alert(msg)
    return result;
    }
}
</script>
</head>

<body>

<form name="frmTest" method="post" action="test_form.html">
<table width="21%" border="0">
  <tr>
    <td id="title">Name</td>
    <td><input type="text" name="name" /></td>
  </tr>
  <tr>
    <td id="eml">email</td>
    <td><input type="text" name="eml" /></td>
  </tr>
  <tr>
    <td><input type="submit" name="Submit" value="Submit" onclick="return CheckTheForm();" /></td>
    <td><input type="reset" name="Reset" value="Reset" /></td>
  </tr>
</table>
</form>
</body>
</html>
Adding a Filter to a Text Element
Categories : Java Script, Data Validation, Form Processing
PHP and javascript mouseover, mouseout, and mousedown events
Categories : PHP, Java Script, Form Processing, Beginner Guides
Changing the Style of form objects using the JavaScript OnClick method.
Categories : Java Script, Form Processing, Beginner Guides, CSS



Show hide table rows to make dynamic forms
Categories : Beginner Guides, Java Script, Form Processing, HTTP
Javascript URL and Email Validation
Categories : Java Script, Data Validation, Form Processing, Email, URLs
Validating a URL with JavaScript RegExp
Categories : Java Script, Data Validation, Beginner Guides
Db_lib - practical example usage of database abstraction and form validation.
Categories : PHP, Form Processing, PHP Classes, Data Validation, Beginner Guides
Simple Javascript CSS Digital Clock
Categories : Java Script, Date Time, CSS, Beginner Guides, Web Design
Form Validation Using PHP to highlight non valid fields
Categories : PHP, Form Processing, Data Validation, Beginner Guides
Conditional Check - a script that allows a user to submit a form only if the user check a checkbox.
Categories : HTML, Java Script, Form Processing, Beginner Guides
Basic Authentication with sessions
Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions
Rollover Image link effect using only single image.
Categories : Web Design, HTML, CSS, Beginner Guides
Upload any fixed type of files, control file type through javascript and encrypt filename using php so file not get overwrite
Categories : PHP, Java Script, Functions, PHP References, Form Processing
Change the background color of a website daily dynamically using the php date function to get the current day of the week and depending on that day, set the background color for the web page.
Categories : PHP, Date Time, Beginner Guides, Web Design