What is Jquery?

jQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML.[1] It was released in January 2006 at BarCamp NYC by John Resig. Used by over 27% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today.

jQuery is free, open source software, dual-licensed under the MIT License and the GNU General Public License, Version 2.[ jQuery's syntax is designed to make it easier to navigate a document, select DOM elements, create animations, handle events, and develop Ajax applications. jQuery also provides capabilities for developers to create plugins on top of the JavaScript library. Utilizing these facilities, developers are able to create abstractions for low-level interaction and animation, advanced effects and high-level, theme-able widgets. This contributes to the creation of powerful and dynamic web pages.

Validation in PHP

1.Create a from





<!-- session security check-->
<?php $securityCheck = new Security(); $securityCheck->UserIsLogin(); ?>

<div id="page_content" style="height:680px;">
<!-- client side validation code -->
<script language="JavaScript">
function doValidation(objForm)
{
//return ;
objFormValidation = new glbDataValidation(objForm);
if(objFormValidation.isFieldValid( 'name', ' Name ', ' Required, LengthMax=255 ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
if(objFormValidation.isFieldValid( 'fatherName', ' Father\'s Name ', ' Required, LengthMax=255 ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
if(objFormValidation.isFieldValid( 'motherName', ' Mother\'s Name ', ' Required, LengthMax=200 ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
if(objFormValidation.isFieldValid( 'presentAddress', ' Present Address ', ' Required, LengthMax=255 ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}

if(objFormValidation.isFieldValid( 'permanentAddress', ' Permanent Address ', ' Required, LengthMax=255 ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
/*if(objFormValidation.isFieldValid( 'passportNo', ' Passport No ', ' Required ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}*/
if(objFormValidation.isFieldValid( 'countryID', ' Country ', ' Required ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
if(objFormValidation.isFieldValid( 'gender', ' Gender ', ' Required ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
if(objFormValidation.isFieldValid( 'dateOfBirth', ' Date Of Birth ', ' Required ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
if(objFormValidation.isFieldValid( 'maritalStatus', ' Marital Status ', ' Required ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
/*if(objFormValidation.isFieldValid( 'religion', ' Religion ', ' Required ' ))
{
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}*/
/*if(document.getElementById('cUserPassword').value != document.getElementById('userPassword').value)
{
alert('Password Mismatch');
document.getElementById('cUserPassword').focus();
}*/
}
</script>


<?php
//$result_view=mysql_query("SELECT OWNER_ID FROM educations where OWNER_ID='$_SESSION[UserID]'");
//allreadyPost=mysql_num_rows($result_view);

$urlLeft = "";

if(!empty($_REQUEST['addMember']))
{
$urlLeft = "&addMember=yes&userID={$_REQUEST['userID']}";
}

if(!empty($_REQUEST['EmployeeID']))
{
//$title = "EDIT REFERENCE";
//$button = "Update";

$query = " SELECT *, SUBSTRING( HEIGHT, 1, 1 ) AS FEET, SUBSTRING( HEIGHT, -9, 2 ) AS INCHES
FROM employees WHERE USER_ID = {$_SESSION['UserID']} AND ISACTIVE = 1 AND EMPLOYEE_ID = {$_REQUEST['EmployeeID']}";
$employeePacket = SelectQuery($query);
$thisEmployeePacket = $employeePacket[0];
$urlLeft = "&EmployeeID={$thisEmployeePacket['EMPLOYEE_ID']}";
}
/*else
{
$title = "CREATE REFERENCE";
$button = "Insert";
}*/

// variable default section
$name = "";
if(!empty($thisEmployeePacket['NAME'])) $name = $thisEmployeePacket['NAME'];
if(!empty($_REQUEST['name'])) $name = $_REQUEST["name"];
$fatherName = '';
if(!empty($thisEmployeePacket['FATHER_NAME'])) $fatherName = $thisEmployeePacket['FATHER_NAME'];
if(!empty($_REQUEST['fatherName'])) $fatherName = $_REQUEST["fatherName"];
$motherName = '';
if(!empty($thisEmployeePacket['MOTHER_NAME'])) $motherName = $thisEmployeePacket['MOTHER_NAME'];
if(!empty($_REQUEST['motherName'])) $motherName = $_REQUEST["motherName"];
$presentAddress = '';
if(!empty($thisEmployeePacket['PRESENT_ADDRESS'])) $presentAddress = $thisEmployeePacket['PRESENT_ADDRESS'];
if(!empty($_REQUEST['presentAddress'])) $presentAddress = $_REQUEST["presentAddress"];
$permanentAddress = '';
if(!empty($thisEmployeePacket['PERMANENT_ADDRESS'])) $permanentAddress = $thisEmployeePacket['PERMANENT_ADDRESS'];
if(!empty($_REQUEST['permanentAddress'])) $permanentAddress = $_REQUEST["permanentAddress"];
$gender = '';
if(!empty($thisEmployeePacket['GENDER'])) $gender = $thisEmployeePacket['GENDER'];
if(!empty($_REQUEST['gender'])) $gender = $_REQUEST["gender"];
$dateOfBirth = '';
if(!empty($thisEmployeePacket['DATE_OF_BIRTH'])) $dateOfBirth = date('d-m-Y', strtotime($thisEmployeePacket['DATE_OF_BIRTH']));
if(!empty($_REQUEST['dateOfBirth'])) $dateOfBirth = date('d-m-Y', strtotime($_REQUEST["dateOfBirth"]));
$maritalStatus = '';
if(!empty($thisEmployeePacket['MARITAL_STATUS'])) $maritalStatus = $thisEmployeePacket['MARITAL_STATUS'];
if(!empty($_REQUEST['maritalStatus'])) $maritalStatus = $_REQUEST["maritalStatus"];
$religion = '';
if(!empty($thisEmployeePacket['RELIGION'])) $religion = $thisEmployeePacket['RELIGION'];
if(!empty($_REQUEST['religion'])) $religion = $_REQUEST["religion"];
$passportNo = '';
if(!empty($thisEmployeePacket['PASSPORT_NO'])) $passportNo = $thisEmployeePacket['PASSPORT_NO'];
if(!empty($_REQUEST['passportNo'])) $passportNo = $_REQUEST["passportNo"];
$countryID = '';
if(!empty($thisEmployeePacket['COUNTRY_ID'])) $countryID = $thisEmployeePacket['COUNTRY_ID'];
if(!empty($_REQUEST['countryID'])) $countryID = $_REQUEST["countryID"];
$heightFeet = '';
if(!empty($thisEmployeePacket['FEET'])) $heightFeet = $thisEmployeePacket['FEET'];
if(!empty($_REQUEST['heightFeet'])) $heightFeet = $_REQUEST["heightFeet"];
$heightInches = '';
if(!empty($thisEmployeePacket['INCHES'])) $heightInches = $thisEmployeePacket['INCHES'];
if(!empty($_REQUEST['heightInches'])) $heightInches = $_REQUEST["heightInches"];


// Set the error flags section
if(empty($error)) $error = false;
if(empty($errorMessage)) $errorMessage = "";

if(empty($nameError)) $nameError = false;
if(empty($fatherNameError)) $fatherNameError = false;
if(empty($motherNameError)) $motherNameError = false;
if(empty($presentAddressError)) $presentAddressError = false;
if(empty($permanentAddressError)) $permanentAddressError = false;
if(empty($passportNoError)) $passportNoError = false;
if(empty($countryIDError)) $countryIDError = false;
if(empty($genderError)) $genderError = false;
if(empty($dateOfBirthError)) $dateOfBirthError = false;
if(empty($religionError)) $religionError = false;
if(empty($maritalStatusError)) $maritalStatusError = false;

?>

<div align="center">
<?php if($error){?><div class="erroMessageLog"><ul><?php print $errorMessage;?></ul></div><?php }?>
<form name="step1Form" action="index.php?area=jobseeker&action=jobseeker-profile-action-step-1<?php echo $urlLeft;?>" method="post">
<table cellpadding="5" cellspacing="0" border="0" width="100%">
<tr>
<td align="left" class="resumeHeading">
<div>
» Personal Information </div> </td>
<td align="right" class="resumeHeading"><strong>Step-1</strong></td>
</tr>
<tr>
<td align="right"> </td>
<td align="left"> </td>
</tr>
<tr>
<td width="30%" align="right"><strong>Name :</strong></td>
<td align="left"><input type="text" name="name" value="<?php print $name;?>" style=" width:250px;" />
<?php if($nameError){ ?>
<span style="color:red;">* </span>
<?php }else{?>
<span>* </span> <?php } ?></td>
</tr>
<tr>
<td width="30%" align="right"><strong>Father's Name :</strong></td>
<td align="left"><input type="text" name="fatherName" value="<?php print $fatherName;?>" style=" width:250px;"><?php if($fatherNameError){ ?> <span style="color:red;">* </span> <?php }else{?> <span>* </span> <?php } ?></td>
</tr>
<tr>
<td width="30%" align="right"><strong>Mother's Name :</strong></td>
<td align="left"><input type="text" name="motherName" value="<?php print $motherName;?>" style=" width:250px;" />
<?php if($motherNameError){ ?> <span style="color:red;">* </span> <?php }else{?> <span>* </span> <?php } ?></td>
</tr>
<tr>
<td width="30%" align="right" valign="top"><strong>Present Address :</strong></td>
<td align="left"><span style="float:left;"><textarea name="presentAddress" rows="5" cols="15" class=" textarea" style=" width:250px;" ><?php print $presentAddress;?></textarea></span><?php if($presentAddressError){ ?> <span style="color:red;">  * </span> <?php }else{?> <span>  * </span> <?php } ?></td>
</tr>
<tr>
<td width="30%" align="right" valign="top"><strong>Permanent Address :</strong></td>
<td align="left"><span style="float:left;"><textarea name="permanentAddress" rows="5" cols="15" class="textarea" style=" width:250px;"><?php print $permanentAddress;?></textarea></span><?php if($permanentAddressError){ ?> <span style="color:red;">  * </span> <?php }else{?> <span>  * </span> <?php } ?></td>
</tr>
<tr>
<td width="30%" align="right" ><strong>Passport No. :</strong></td>
<td align="left"><input type="text" name="passportNo" value="<?php print $passportNo;?>" style=" width:250px;" ><?php if($passportNoError){ ?> <span style="color:red;">* </span> <?php }?></td>
</tr>
<tr>
<td width="30%" align="right"><strong>Nationality :</strong></td>
<td align="left">
<select type="text" name="countryID" style="width:253px; " class="inputText" >
<option value="">Select Country</option>

<?php
$query = " SELECT * FROM countrys WHERE 1 = 1 ORDER BY COUNTRY";
$countryPacket = SelectQuery($query);
foreach($countryPacket as $thisCountryPacket)
{
print "
<option value=\"{$thisCountryPacket['COUNTRY_ID']}\"
";
if($thisCountryPacket['COUNTRY_ID'] == $countryID) print " selected";

print ">{$thisCountryPacket['COUNTRY']}</option>
";
}
?>
</select><?php if($passportNoError){ ?> <span style="color:red;">* </span> <?php }else{?> <span>  * </span> <?php } ?> </td>
</tr>
<tr>
<td align="right"><strong>Gender :</strong></td>
<td align="left">
<input type="radio" name="gender" value="Male" <?php if($gender == "Male") print "checked";?> />Male
<input type="radio" name="gender" value="Female" <?php if($gender == "Female") print "checked";?> />Female
<?php if($genderError){ ?> <span style="color:red;">* </span> <?php }else{?> <span>  * </span> <?php } ?>
</td>
</tr>
<tr>
<td align="right"><strong>Date of Birth :</strong></td>
<td align="left">
<input type="text" name="dateOfBirth" value="<?php print $dateOfBirth;?>" readonly="readonly" size="10" style="width:250px" >
<img src="./skin/<?php echo $_REQUEST['skin']; ?>/images/calendar/cal.gif" width="16" height="16" alt="Pick a date" onClick="scwShow(scwID('dateOfBirth'),event);" style="cursor:pointer;"/>
<?php if($dateOfBirthError){ ?><span style="color:red;">* </span> <?php }else{?> <span>  * </span> <?php } ?> </td>
</tr>
<tr>
<td align="right"><strong>Marital Status :</strong></td>
<td align="left">
<select name="maritalStatus" style="width:253px; " class="inputText" >
<option value="">Select</option>
<option value="Single" <?php if($maritalStatus == "Single") print "selected";?>>Single</option>
<option value="Married" <?php if($maritalStatus == "Married") print "selected";?>>Married</option>
<option value="Widowed" <?php if($maritalStatus == "Widowed") print "selected";?>>Widowed</option>
<option value="Divorced" <?php if($maritalStatus == "Divorced") print "selected";?>>Divorced</option>
<option value="Separated" <?php if($maritalStatus == "Separated") print "selected";?>>Separated</option>
</select><?php if($maritalStatusError){ ?> <span style="color:red;">* </span> <?php }else{?> <span>  * </span> <?php } ?>
</td>
</tr>
<tr>
<td align="right"><strong>Height :</strong></td>
<td align="left">
<select name="heightFeet" class="inputText" style=" width:108px;">
<option value="">Select Feet</option>
<?php
for($i=3;$i<=8;$i++)
{
print "
<option value='{$i}'
";
if($heightFeet == $i) print "selected";
print">{$i}</option>
";
}
?>
</select> Feet 
<select name="heightInches" class="inputText" style=" width:108px;">
<option value="0">Select Inches</option>
<?php
for($i=0;$i<=11;$i++)
{
print "
<option value='{$i}'
";
if($heightInches == $i) print "selected";
print">{$i}</option>
";

}
?>
</select> Inches </td>
</tr>
<tr>
<td align="right"><strong>Religion :</strong></td>
<td align="left">
<select name="religion" style="width:253px; " class="inputText" >
<option value="">Select Religion</option>
<option value="Islam" <?php if($religion == "Islam") print "selected";?>>Islam</option>
<option value="Hindu" <?php if($religion == "Hindu") print "selected";?>>Hindu</option>
<option value="Christian" <?php if($religion == "Christian") print "selected";?>>Christian</option>
<option value="Buddist" <?php if($religion == "Buddist") print "selected";?>>Buddist</option>
<option value="Others" <?php if($religion == "Others") print "selected";?>>Others</option>
</select>
<?php if($religionError){ ?> <span style="color:red;">*</span> <?php }?>
</td>
</tr>
<tr>
<td></td>
<td align="left">
<input type="hidden" value="<?php echo $urlLeft;?>" name="urlLeft">
<?php
if(!empty($_REQUEST['EmployeeID']))
{
?>
<input type="submit" value="Update" onclick="return doValidation(step1Form);" class="btton-details">
<?php
}
else
{
?>
<input type="submit" value="Next" onclick="return doValidation(step1Form);" class="btton-details">
<input type="submit" value="skip" name="skip" class="btton-details">
<?php
}
?>
</td>
</tr>
</table>
</form>
</div>
</div>


Javascript Validation

validation.js


// ************************************************************************
// * Begin Data Validation constructor
// ************************************************************************

function glbDataValidation(paramFormName){
/************************************************************
* Begin configure error message
************************************************************/
var REQUIRED = "The <fieldlabel> field is required";
var LENGTHMIN = "The <fieldlabel> field can not contain fewer than <length> characters.";
var LENGTHMAX = "The <fieldlabel> field can not contain more than <length> characters.";
var TEXTONLY = "The <fieldlabel> field must contain text only.";
var NUMONLY = "The <fieldlabel> field must contain only numbers.";
var NUMONLY_LT_MAXIMUM = "The <fieldlabel> field must be a number less than or equal to <maximum>.";
var NUMONLY_GT_MINIMUM = "The <fieldlabel> field must be a number greater than or equal to <minimum>.";
var ISMONEY = "The <fieldlabel> field must contain a numbers such as 200,000.00.";
var ISMONEY_DOLLARSIGN = "The <fieldlabel> field contains a dollar sign. Remove it and try again.";
var ISMONEY_LT_MAXIMUM = "The <fieldlabel> field must be a number less than or equal to <maximum>.";
var ISMONEY_GT_MINIMUM = "The <fieldlabel> field must be a number greater than or equal to <minimum>.";
var ISNUMFORMAT = "The <fieldlabel> field must contain only numbers.";
var ISNUMFORMAT_LT_MAXIMUM = "The <fieldlabel> field must be a number less than or equal to <maximum>.";
var ISNUMFORMAT_GT_MINIMUM = "The <fieldlabel> field must be a number greater than or equal to <minimum>.";
var ALPHACHARONLY = "The <fieldlabel> field must contain only letters from A-Z.";
var NOCHARONLY = "The <fieldlabel> field field must contain only letters from A-Z and numbers from 0-9";
var ISEMAIL = "The <fieldlabel> field contains an invalid email address\. Example: myname@domain\.com";
var COMPAREFIELD = "The <fieldlabel> does not confirm. Check the spelling then try again";
var ISUSERNAME = "The <fieldlabel> field is an invalid user name\.";
ISUSERNAME += "The <fieldlabel> accepts letters from A-Z, numbers from 0-9, \'_\', and \'-\'\.";
ISUSERNAME += "The <fieldlabel> must contain more than 4 and less than 30 characters\.";
var ISPASSWORD = "The <fieldlabel> field is an invalid password\.";
ISPASSWORD += " The field only accepts letters from A-Z, numbers from 0-9, \'_\', and \'-\'\.";
ISPASSWORD += " The field must contain more than 8 and less than 20 characters\.";

/************************************************************
* End configure error message
************************************************************/

/************************************************************
* Begin public methods
************************************************************/
this.isFieldValid = isFieldValid;
this.getErrorMessage = getErrorMessage;
this.doErrorAlertPrompt = doErrorAlertPrompt;
this.getFieldObject = getFieldObject;
this.isBlank = isBlank; // returns a true or false;
/************************************************************
* End public methods
************************************************************/

/************************************************************
* Begin create the form object if the client passes an object
* or an form name;
************************************************************/
var objForm = null;
if(typeof paramFormName == 'object'){ // if the client passes a form object
objForm = paramFormName;
} else { // if the user passes a form name
objForm = eval('document.'+paramFormName);
}
/************************************************************
* End create the form object if the client passes an object
************************************************************/

/************************************************************
* Begin variables/objects used by methods through out the component.
************************************************************/
var objField = null;
var strErrMessage = "";
/************************************************************
* End variables/objects used by methods through out the component.
************************************************************/


function getErrorMessage(){
return strErrMessage;
}

function doErrorAlertPrompt(){
alert(strErrMessage);
return false;
}

function setErrorMessage(msg){
strErrMessage = msg;
}

function getFieldObject(){
return objField;
}


function doErrorDetected(msg){
strErrMessage = msg;
blnErrorFlag = true;
}

function isBlank(s){ // This function is used to check for blank field
var checkchar = s.replace(/\s*\n*\t*\r*/g,'');
if (checkchar == ''){
return true;
} else {
return false;
}
}

function isFieldValid(frmFieldName,frmFriendlyName,frmValidate){
objField = eval('objForm'+'.'+frmFieldName);
blnErrorFlag = false;

// ************************************************************************
// * Begin prepare the field object variables use for validation
// ************************************************************************

var objTextProp = new Object();
objTextProp.frmFieldType = objField.type;

frmValidate = frmValidate.toLowerCase()


if(!objTextProp.frmFieldType){
objTextProp.frmFieldType = 'checked' ;
}
// ************************************************************************
// End prepare the field object variables use for validation
// ************************************************************************
// ************************************************************************
// *Begin Only Text, Textarea and Password fields can access the following code
// ************************************************************************

if (objTextProp.frmFieldType == 'text' || objTextProp.frmFieldType == 'textarea' ||
objTextProp.frmFieldType == 'password' || objTextProp.frmFieldType == 'hidden' ||
objTextProp.frmFieldType == 'file'){


if (blnErrorFlag == false && frmValidate.match(/required/g)){
if (isBlank(objField.value)){
msg = REQUIRED.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}


if (blnErrorFlag == false && frmValidate.match(/lengthmin=\d*/g)){
var minlength = eval('"'+frmValidate.match(/lengthmin=\d*/g)+'"');
minlength = parseInt(minlength.match(/\d+/));
if (!isBlank(objField.value) && objField.value.length < minlength){
msg = LENGTHMIN.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<length>',minlength);
doErrorDetected(msg);
}
}

if (blnErrorFlag == false && frmValidate.match(/lengthmax=\d*/g)){
var maxlength = eval('"'+frmValidate.match(/lengthmax=\d*/g)+'"');
maxlength = parseInt(maxlength.match(/\d+/));
if (!isBlank(objField.value) && objField.value.length > maxlength){
msg = LENGTHMAX.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<length>',maxlength);
doErrorDetected(msg);
}
}

if (blnErrorFlag == false && frmValidate.match(/textonly/g)){
if (!isNaN(objField.value) && !isBlank(objField.value)){
msg = TEXTONLY.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}

// Begin only number validations
if (blnErrorFlag == false && frmValidate.match(/numonly/g)){
if (isNaN(objField.value.replace(/[\.]/g,'a')) && !isBlank(objField.value) ){
msg = NUMONLY.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}

if (!isNaN(objField.value.replace(/[\.]/g,'a'))
&& !isBlank(objField.value) ){
tmpMinMaxValue = frmValidate.match(/numonly\[[\d]+,[\d]+\]/g);

if(tmpMinMaxValue){
// Begin build the array
tmpMinMaxValue2 = ''+frmValidate.match(/numonly\[[\d]+,[\d]+\]/g);
tmpMinMaxValue2 = eval(tmpMinMaxValue2.replace(/numonly/,''));
tmpMinValue = tmpMinMaxValue2[0] // Min
tmpMaxValue = tmpMinMaxValue2[1] // Max
// End build the array

// Begin check to see if the developer has the number range correct.
// Else check the validation.
if(tmpMinValue > tmpMaxValue){
alert('Component Error: The Minimun can not greater that the Maximum');
return false;
// Begin check to see if the developer has the number range correct.

} else {
if(objField.value.replace(/[\.]/g,'a') < tmpMinValue){
msg = NUMONLY_GT_MINIMUM.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<minimum>',tmpMinValue);
doErrorDetected(msg);
} else if(objField.value.replace(/[\.]/g,'a') > tmpMaxValue){
msg = NUMONLY_LT_MAXIMUM.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<maximum>',tmpMaxValue);
doErrorDetected(msg);
}
}
}
}
}
// End only number validations

// Begin money format.
if (blnErrorFlag == false && frmValidate.match(/ismoney/g)){
if (isNaN(objField.value.replace(/[,$]/g,''))
&& !isBlank(objField.value)){
msg = ISMONEY.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
} else if(objField.value.match(/[$]/g)) {
msg = ISMONEY_DOLLARSIGN.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}

if (!blnErrorFlag){
tmpMinMaxValue = frmValidate.match(/ismoney\[[\d]+,[\d]+\]/g);

if(tmpMinMaxValue){
// Begin build the array
tmpMinMaxValue2 = ''+frmValidate.match(/ismoney\[[\d]+,[\d]+\]/g);
tmpMinMaxValue2 = eval(tmpMinMaxValue2.replace(/ismoney/,''));
tmpMinValue = tmpMinMaxValue2[0] // Min
tmpMaxValue = tmpMinMaxValue2[1] // Max
// End build the array

// Begin check to see if the developer has the number range correct.
// Else check the validation.
if(tmpMinValue > tmpMaxValue){
alert('Component Error: The Minimun can not greater that the Maximum');
return false;
} else {
// End check to see if the developer has the number range correct.

if(objField.value.replace(/[,$]/g,'') < tmpMinValue){
msg = ISMONEY_GT_MINIMUM.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<minimum>',tmpMinValue);
doErrorDetected(msg);
} else if(objField.value.replace(/[,$]/g,'') > tmpMaxValue){
msg = ISMONEY_LT_MAXIMUM.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<maximum>',tmpMinValue);
doErrorDetected(msg);
}
}
}
}
}
// End money format.

// Begin Number Format
if (blnErrorFlag == false && frmValidate.match(/isnumformat/g)){

if (isNaN(objField.value.replace(/[,]/g,''))
&& !isBlank(objField.value) ){
msg = ISNUMFORMAT.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}

if (!blnErrorFlag){
tmpMinMaxValue = frmValidate.match(/isnumformat\[[\d]+,[\d]+\]/g);

if(tmpMinMaxValue){
// Begin build the array
tmpMinMaxValue2 = ''+frmValidate.match(/isnumformat\[[\d]+,[\d]+\]/g);
tmpMinMaxValue2 = eval(tmpMinMaxValue2.replace(/isnumformat/,''));
tmpMinValue = tmpMinMaxValue2[0] // Min
tmpMaxValue = tmpMinMaxValue2[1] // Max
// End build the array


if(tmpMinValue > tmpMaxValue){
alert('Component Error: The Minimun can not greater that the Maximum');
return false;
} else {

if(objField.value.replace(/[,]/g,'') < tmpMinValue){
msg = ISNUMFORMAT_GT_MINIMUM.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<minimum>',tmpMinValue);
doErrorDetected(msg);
} else if(objField.value.replace(/[,]/g,'') > tmpMaxValue){
msg = ISNUMFORMAT_GT_MINIMUM.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<minimum>',tmpMaxValue);
doErrorDetected(msg);
}
}
}
}
}
//End Number Format
if (blnErrorFlag == false && frmValidate.match(/alphacharonly/g)){
if (objField.value.replace(/(([a-z])*)(([A-Z])*)/g,'') != ''
&& !isBlank(objField.value)){
msg = ALPHACHARONLY.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}
if (blnErrorFlag == false && frmValidate.match(/nocharonly/g)){
if (eval(objField.value.replace(/(([a-z])*)(([A-Z])*)(\d*)/g,'')) != ''
&& !isBlank(objField.value)){
msg = NOCHARONLY.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}
if (blnErrorFlag == false && frmValidate.match(/isemail/g)){
if (eval(objField.value.match(/\w@\w+\.\w{2,3}/g)) == null
&& !isBlank(objField.value)){
msg = ISEMAIL.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}
if (blnErrorFlag == false && frmValidate.match(/comparefield/g)){
var txtFieldObject = eval('"'+frmValidate.match(/comparefield=\w*.\w*.\w*/g)+'"')
txtFieldObject = txtFieldObject.replace(/CompareField=/,'')
if (eval(objField.value) != eval(txtFieldObject+'.value')){
msg = COMPAREFIELD.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}
if (blnErrorFlag == false && frmValidate.match(/isusername/g)){
if (
(
(objField.value.match(/[aA-zZ|0-9|_|-]+/g)
!= objField.value)
&& !isBlank(objField.value)
)
||
(
(objField.value.length < 4) || (objField.value.length > 30))
){
msg = ISUSERNAME.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}
if (blnErrorFlag == false && frmValidate.match(/ispassword/g)){
if (
(
(objField.value.match(/[aA-zZ|0-9|_|-]+/g)
!= objField.value)
&& !isBlank(objField.value)
)
||
(
(objField.value).length < 8 || eval(objField.value.length > 20)
)
){
msg = ISPASSWORD.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}
}

// ************************************************************************
// *End Only Text, Textarea and Password fields can access the following code
// ************************************************************************

// ************************************************************************
// * Only OPTION fields can access the following code
// ************************************************************************
if (objTextProp.frmFieldType == 'select-multiple' || objTextProp.frmFieldType == 'select-one'){

if (blnErrorFlag == false && frmValidate.match(/required/g)){
var strSelectedValue = '';
var strSelectedLength = 0;
for (var i = 0; i < objField.length; i++) { // Loop through the selected items to create the strSelectedValue
if (objField.options[i].selected){
strSelectedValue = strSelectedValue += objField.options[i].value;
}
}

if (strSelectedValue == ''){
msg = REQUIRED.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}
}

if (blnErrorFlag == false && frmValidate.match(/lengthmin=\d*/g)){
var strSelectedLength = 0;
var minlength = eval('"'+frmValidate.match(/lengthmin=\d*/g)+'"');
minlength = parseInt(minlength.match(/\d+/));
for (var i = 0; i < objField.length; i++) { // Loop through the selected items to create the strSelectedValue
if (objField.options[i].selected){
++strSelectedLength;
}
}

if (strSelectedLength < minlength){
msg = LENGTHMIN.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<length>',minlength);
if(minlength == 1){
msg += ".";
} else {
msg += "s.";
}
doErrorDetected(msg);
}
}

if (blnErrorFlag == false && frmValidate.match(/lengthmax=\d*/g)){
var strSelectedLength = 0;
var maxlength = eval('"'+frmValidate.match(/lengthmax=\d*/g)+'"');
maxlength = parseInt(maxlength.match(/\d+/));

for (var i = 0; i < objField.length; i++) { // Loop through the selected items to create the strSelectedValue
if (objField.options[i].selected){
strSelectedLength = strSelectedLength+1;
}
}
if (strSelectedLength > maxlength ){
msg = LENGTHMAX.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<length>',maxlength);
doErrorDetected(msg);
}
}
}
// ************************************************************************
// * End of Only OPTION fields can access the following code
// ************************************************************************

// ************************************************************************
// * Only radio and check box fields can access the following code
// ************************************************************************
if (objTextProp.frmFieldType == 'checked'){
if (blnErrorFlag == false && frmValidate.match(/required/g)){
var strSelectedValue = '';

for (i = 0, j = objField.length; i < j; i++) { // Loop through the selected items to create the strSelectedValue
if (objField[i].checked == true){
strSelectedValue = strSelectedValue += objField[i].value;
}
}

if (strSelectedValue == ''){
msg = REQUIRED.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
doErrorDetected(msg);
}

}

if (blnErrorFlag == false && frmValidate.match(/lengthmin=\d*/g)){
var strSelectedLength = 0
var minlength = eval('"'+frmValidate.match(/lengthmin=\d*/g)+'"');
minlength = parseInt(minlength.match(/\d+/));

for (i = 0, j = objField.length; i < j; i++) { // Loop through the selected items to create the strSelectedValue
if (objField[i].checked == true){
++strSelectedLength;
}
}

if (strSelectedLength < minlength){
msg = LENGTHMIN.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<length>',minlength);
if(minlength == 1){
msg += ".";
} else {
msg += "s.";
}
doErrorDetected(msg);
}
}

if (blnErrorFlag == false && frmValidate.match(/lengthmax=\d*/g)){
var strSelectedLength = 0
var maxlength = eval('"'+frmValidate.match(/lengthmax=\d*/g)+'"');
maxlength = parseInt(maxlength.match(/\d+/));

for (i = 0, j = objField.length; i < j; i++) { // Loop through the selected items to create the strSelectedValue
if (objField[i].checked == true){
++strSelectedLength;
}
}

if (strSelectedLength > maxlength){
msg = LENGTHMAX.replace('<fieldlabel>',frmFriendlyName.toUpperCase());
msg = msg.replace('<length>',maxlength);
doErrorDetected(msg);
}
}
}
// ************************************************************************
// * End of only radio and check box fields can access the following code
// ************************************************************************

// Begn the return value sent back let the client know the field pass or failed
// the validation
return blnErrorFlag;
// End the return value sent back let the client know the field pass or failed
}

}



function Confirmit(mess) {
var confirmVar=confirm(mess);
return confirmVar;

}

// ************************************************************************
// * A new function added to check for valid dates
// ************************************************************************



function isDate(dateStr) {

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
var matchArray = dateStr.match(datePat); // is the format ok?

if (matchArray == null) {
alert("Please enter date as either mm/dd/yyyy or mm-dd-yyyy.");
return false;
}

month = matchArray[1]; // p@rse date into variables
day = matchArray[3];
year = matchArray[5];

if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return false;
}

if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
return false;
}

if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn`t have 31 days!")
return false;
}

if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day > 29 || (day==29 && !isleap)) {
alert("February " + year + " doesn`t have " + day + " days!");
return false;
}
}
return true; // date is valid
}

function isEuroDate(dateStr) {

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
var matchArray = dateStr.match(datePat); // is the format ok?

if (matchArray == null) {
alert("Please enter date as either mm/dd/yyyy or mm-dd-yyyy.");
return false;
}

day = matchArray[1]; // p@rse date into variables
month = matchArray[3];
year = matchArray[5];

if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return false;
}

if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
return false;
}

if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn`t have 31 days!")
return false;
}

if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day > 29 || (day==29 && !isleap)) {
alert("February " + year + " doesn`t have " + day + " days!");
return false;
}
}
return true; // date is valid
}

How to use pagination in php

DESCRIPTION
--------------
This set contains 3 different pagination functions that can be easily implemented
into any other script to paginate the output results retrieved from MySQL database
or elsewhere. Note that these functions do not query the DB by theirselves, you
should previously have counted the total number of matches and retrieved the
appropriate results, specified number of results per page etc.


USAGE
---------
1. Upload the appropriate function script to the root folder on your server.
2. Open demo.php in any text editor to find out the inclusion code for the
appropriate function.
3. Paste the code into your scripts. Note that if you use other variable names
in your scripts, you will have to provide those names in function calling
code instead the specified ones.
4. Feel free to link to paginate.css file from your scripts to stylize the links.

Start Coding



Start Coding

1.demo.php

<?php
//pagination example code
$adjacents = intval($_GET['adjacents']);

if(!$page) $page = 1;
if(!$adjacents) $adjacents = 4;

$reload = $_SERVER['PHP_SELF'] . "?tpages=" . $tpages . "&adjacents=" . $adjacents;
?>
<html>
<head>
<title>Pagination Example</title>
<link rel="stylesheet" type="text/css" href="paginate.css">
</head>
<body>

<div align="center">
<p><b>Pagination DEMO</b></p>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="get">
<table cellspacing="0" cellpadding="4">
<tr><th>Specify values for pagination test:</th></tr>
<tr><td>total pages: <input type="text" name="tpages" size="2" value="<?=$tpages;?>">,
adjacents: <input type="text" name="adjacents" size="2" value="<?=$adjacents;?>">
<input type="submit" value="Go"></td></tr>
</table>
</form>
<br>
<p><b>View Results for page <?=$page;?> of <?=$tpages;?> (adjacent pages: <?=$adjacents;?>)</b></p>
<p>paginate_one:</p>
<?php
include("pagination1.php");
echo paginate_one($reload, $page, $tpages);
?>
<br>
<p>paginate_two:</p>
<?php
include("pagination2.php");
echo paginate_two($reload, $page, $tpages, $adjacents);
?>
<br>
<p>paginate_three:</p>
<?php
include("pagination3.php");
echo paginate_three($reload, $page, $tpages, $adjacents);

?>
</div>

</body>
</html>


2.Attaching stylesheet pagination.css in demo.php

/* pagination style */
.pagin {
padding: 2px 0;
margin: 0;
font-family: "Verdana", sans-serif;
font-size: 7pt;
font-weight: bold;
}
.pagin * {
padding: 2px 6px;
margin: 0;
}
.pagin a {
border: solid 1px #666666;
background-color: #EFEFEF;
color: #666666;
text-decoration: none;
}
.pagin a:visited {
border: solid 1px #666666;
background-color: #EFEFEF;
color: #60606F;
text-decoration: none;
}
.pagin a:hover, .pagin a:active {
border: solid 1px #CC0000;
background-color: white;
color: #CC0000;
text-decoration: none;
}
.pagin span {
cursor: default;
border: solid 1px #808080;
background-color: #F0F0F0;
color: #B0B0B0;
}
.pagin span.current {
border: solid 1px #666666;
background-color: #666666;
color: white;
}

<?php
/*************************************************************************
php easy :: pagination scripts set - Version One
==========================================================================
********************/
function paginate_one($reload, $page, $tpages) {

$firstlabel = "First";
$prevlabel = "Prev";
$nextlabel = "Next";
$lastlabel = "Last";

$out = "<div class=\"pagin\">\n";

// first
if($page>1) {
$out.= "<a href=\"" . $reload . "\">" . $firstlabel . "</a>\n";
}
else {
$out.= "<span>" . $firstlabel . "</span>\n";
}

// previous
if($page==1) {
$out.= "<span>" . $prevlabel . "</span>\n";
}
elseif($page==2) {
$out.= "<a href=\"" . $reload . "\">" . $prevlabel . "</a>\n";
}
else {
$out.= "<a href=\"" . $reload . "&page=" . ($page-1) . "\">" . $prevlabel . "</a>\n";
}

// current
$out.= "<span class=\"current\">Page " . $page . " of " . $tpages . "</span>\n";

// next
if($page<$tpages) {
$out.= "<a href=\"" . $reload . "&page=" .($page+1) . "\">" . $nextlabel . "</a>\n";
}
else {
$out.= "<span>" . $nextlabel . "</span>\n";
}

// last
if($page<$tpages) {
$out.= "<a href=\"" . $reload . "&page=" . $tpages . "\">" . $lastlabel . "</a>\n";
}
else {
$out.= "<span>" . $lastlabel . "</span>\n";
}

$out.= "</div>";

return $out;
}
?>
<?php
/*************************************************************************
php easy :: pagination scripts set - Version Two
==========================================================================
*************************************************************************/
function paginate_two($reload, $page, $tpages, $adjacents) {

$firstlabel = "« ";
$prevlabel = "‹ ";
$nextlabel = " ›";
$lastlabel = " »";

$out = "<div class=\"pagin\">\n";

// first
if($page>($adjacents+1)) {
$out.= "<a href=\"" . $reload . "\">" . $firstlabel . "</a>\n";
}
else {
$out.= "<span>" . $firstlabel . "</span>\n";
}

// previous
if($page==1) {
$out.= "<span>" . $prevlabel . "</span>\n";
}
elseif($page==2) {
$out.= "<a href=\"" . $reload . "\">" . $prevlabel . "</a>\n";
}
else {
$out.= "<a href=\"" . $reload . "&page=" . ($page-1) . "\">" . $prevlabel . "</a>\n";
}

// 1 2 3 4 etc
$pmin = ($page>$adjacents) ? ($page-$adjacents) : 1;
$pmax = ($page<($tpages-$adjacents)) ? ($page+$adjacents) : $tpages;
for($i=$pmin; $i<=$pmax; $i++) {
if($i==$page) {
$out.= "<span class=\"current\">" . $i . "</span>\n";
}
elseif($i==1) {
$out.= "<a href=\"" . $reload . "\">" . $i . "</a>\n";
}
else {
$out.= "<a href=\"" . $reload . "&page=" . $i . "\">" . $i . "</a>\n";
}
}

// next
if($page<$tpages) {
$out.= "<a href=\"" . $reload . "&page=" .($page+1) . "\">" . $nextlabel . "</a>\n";
}
else {
$out.= "<span>" . $nextlabel . "</span>\n";
}

// last
if($page<($tpages-$adjacents)) {
$out.= "<a href=\"" . $reload . "&page=" . $tpages . "\">" . $lastlabel . "</a>\n";
}
else {
$out.= "<span>" . $lastlabel . "</span>\n";
}

$out.= "</div>";

return $out;
}
?>

<?php
/*************************************************************************
php easy :: pagination scripts set - Version Three
==========================================================================
*************************************************************************/
function paginate_three($reload, $page, $tpages, $adjacents) {

$prevlabel = "‹ Prev";
$nextlabel = "Next ›";

$out = "<div class=\"pagin\">\n";

// previous
if($page==1) {
$out.= "<span>" . $prevlabel . "</span>\n";
}
elseif($page==2) {
$out.= "<a href=\"" . $reload . "\">" . $prevlabel . "</a>\n";
}
else {
$out.= "<a href=\"" . $reload . "&page=" . ($page-1) . "\">" . $prevlabel . "</a>\n";
}

// first
if($page>($adjacents+1)) {
$out.= "<a href=\"" . $reload . "\">1</a>\n";
}

// interval
if($page>($adjacents+2)) {
$out.= "...\n";
}

// pages
$pmin = ($page>$adjacents) ? ($page-$adjacents) : 1;
$pmax = ($page<($tpages-$adjacents)) ? ($page+$adjacents) : $tpages;
for($i=$pmin; $i<=$pmax; $i++) {
if($i==$page) {
$out.= "<span class=\"current\">" . $i . "</span>\n";
}
elseif($i==1) {
$out.= "<a href=\"" . $reload . "\">" . $i . "</a>\n";
}
else {
$out.= "<a href=\"" . $reload . "&page=" . $i . "\">" . $i . "</a>\n";
}
}

// interval
if($page<($tpages-$adjacents-1)) {
$out.= "...\n";
}

// last
if($page<($tpages-$adjacents)) {
$out.= "<a href=\"" . $reload . "&page=" . $tpages . "\">" . $tpages . "</a>\n";
}

// next
if($page<$tpages) {
$out.= "<a href=\"" . $reload . "&page=" . ($page+1) . "\">" . $nextlabel . "</a>\n";
}
else {
$out.= "<span>" . $nextlabel . "</span>\n";
}

$out.= "</div>";

return $out;
}
?>

Make website attractive using jquery

Make website attractive using jquery:
<!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=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
</head>

<body>
<div><a href=""> Home</a></div>
<a href=""> Home</a></div>

<div id="divTopRight" style="position: absolute; left: 1122px; top: 10px;">
<div><img src="images/Untitled-1.png" /></div>

<!--[if lt IE 6.]>
<img src="images/badge2.gif"/>
<![endif]-->

</div>

<script type="text/javascript">
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function JSFX_FloatDiv(id, sx, sy)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
var px = document.layers ? "" : "px";
window[id + "_obj"] = el;
if(d.layers)el.style=el;
el.cx = el.sx = sx;el.cy = el.sy = sy;
el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

el.floatIt=function()
{
var pX, pY;
pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
document.documentElement && document.documentElement.clientWidth ?
document.documentElement.clientWidth : document.body.clientWidth;
pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ?
document.documentElement.scrollTop : document.body.scrollTop;
if(this.sy<0)
pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ?
document.documentElement.clientHeight : document.body.clientHeight;
this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
this.sP(this.cx, this.cy);
setTimeout(this.id + "_obj.floatIt()", 40);
}
return el;
}
JSFX_FloatDiv("divTopRight", -170, 10).floatIt();

</script>
<!-- ********************************************************* -->


</body>
</html>

Office picture: Me & my


This is my office...me ,with kobir bhai & Sobuj da
powered by Blogger | WordPress by Newwpthemes | Converted by BloggerTheme