Skip to content

Instantly share code, notes, and snippets.

@PintuKumarPal
Created August 29, 2013 23:56
Show Gist options
  • Save PintuKumarPal/6384815 to your computer and use it in GitHub Desktop.
Save PintuKumarPal/6384815 to your computer and use it in GitHub Desktop.
<cfoutput>
<script type="text/javascript" src="includes/jquery.js"></script>
<script type="text/javascript" src="includes/jquery.validate.pack.js"></script>
<script type="text/javascript" src="includes/jquery.form.js"></script>
<script type="text/javascript">
function ProcessValidateForm()
{
$("##ProcessStatus").html('Processing...');
$.post('update.cfc?method=UpdateMethod&returnFormat=plain',
$("##ValidateForm").serialize(),
function(data,ProcessStatus)
{
data = $.trim(data)
if (data == 'success')
{
$("##ProcessStatus").html('Record Insert Successfully');
}
});
return false
}
$(document).ready(function()
{
$("##ValidateForm").validate(
{
rules:
{
FirstName: {required: true},
EmailID:{required:true,email:true},
ContactNo:{required:true}
},
messages:
{
FirstName: '&nbsp;**',
EmailID: '&nbsp;**',
ContactNo: '&nbsp;**'
},
submitHandler: function(form)
{
$(form).ajaxSubmit(ProcessValidateForm);
}
});
});
</script>
<script type="text/javascript">
function intOnly(i)
{
if (i.value.length > 0)
{
i.value = i.value.replace(/[^\d]+/g, '');
}
}
</script>
<form id="ValidateForm">
<table width="990" border="0" cellpadding="0" cellspacing="10" bordercolor="Red">
<tr>
<td></td>
<td><div id="ProcessStatus"></div></td>
</tr>
<tr>
<td width="120" class="TableText" align="right" valign="middle">First Name: *</td>
<td><input type="text" name="FirstName" id="FirstName" value="" Class="TableText" size="35"></td>
</tr>
<tr>
<td width="120" class="TableText" align="right" valign="top">Email ID:&nbsp;*</td>
<td><input type="text" name="EmailID" id="EmailID" value="" size="35"></td>
</tr>
<tr>
<td class="TableText" align="right" valign="top">Country:&nbsp;</td>
<td><input type="text" name="Qualification" id="Qualification" value="" Class="TableText" size="35"> </td>
</tr>
<tr>
<td class="TableText" align="right" valign="middle" width="120">Contact No:&nbsp;*</td>
<td><input type="text" maxlength="10" id="ContactNo" name="ContactNo" value="" size="35" onKeyUp="javascript:intOnly(this);">
</td>
</tr>
<tr>
<td></td>
<td align="left"><input type="submit" value="S U B M I T" /></td>
</tr>
</table>
</form>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment