Skip to content

Instantly share code, notes, and snippets.

@shane-reaume
Created April 10, 2013 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shane-reaume/5356230 to your computer and use it in GitHub Desktop.
Save shane-reaume/5356230 to your computer and use it in GitHub Desktop.
Form filters
/**
* Created By: Shane Reaume
* Date: 12/17/12
* Time: 10:20 AM
*/
/* form filters -Shane */
$(function() {
var yourFacilityinput = $('label:contains("Your Facility")').parent('div').find('input');
$(yourFacilityinput).keyup(function(){ var value = $(this).val().replace(/[^0-9a-zA-Z-' ]/g, ""); $(this).val(value)});
var yourNameinput = $('label:contains("Your Name")').parent('div').find('input');
$(yourNameinput).keyup(function(){ var value = $(this).val().replace(/[^a-zA-Z ]/g, ""); $(this).val(value)});
var patientFirstinput = $('label:contains("Patient First Name")').parent('div').find('input');
$(patientFirstinput).keyup(function(){ var value = $(this).val().replace(/[^a-zA-Z]/g, ""); $(this).val(value)});
var patientLastinput = $('label:contains("Patient Last Name")').parent('div').find('input');
$(patientLastinput).keyup(function(){ var value = $(this).val().replace(/[^a-zA-Z]/g, ""); $(this).val(value)});
var patientPhoneinput = $('label:contains("Patient Phone #")').parent('div').find('input');
$(patientPhoneinput).keyup(function(){ var value = $(this).val().replace(/[^0-9-)(]/g, ""); $(this).val(value)});
var patientAlternateinput = $('label:contains("Alternate Phone #")').parent('div').find('input');
$(patientAlternateinput).keyup(function(){ var value = $(this).val().replace(/[^0-9-)(_)(]/g, ""); $(this).val(value)});
var patientdobinput = $('label:contains("Patient DOB")').parent('div').find('input');
$(patientdobinput).keyup(function(){ var value = $(this).val().replace(/[^0-9-]/g, ""); $(this).val(value)});
var patientAddressinput = $('label:contains("Address")').parent('div').find('input');
$(patientAddressinput).keyup(function(){ var value = $(this).val().replace(/[^0-9a-zA-Z-'#/)( ]/g, ""); $(this).val(value)});
var patientCityinput = $('label:contains("City")').parent('div').find('input');
$(patientCityinput).keyup(function(){ var value = $(this).val().replace(/[^a-zA-Z- )( ]/g, ""); $(this).val(value)});
var patientStateinput = $('label:contains("State")').parent('div').find('input');
$(patientStateinput).attr('maxlength','2');
$(patientStateinput).keyup(function(){ var value = $(this).val().replace(/[^a-zA-Z)( ]/g, "").toUpperCase(); $(this).val(value)});
var patientZipinput = $('label:contains("Zip")').parent('div').find('input');
$(patientZipinput).keyup(function(){ var value = $(this).val().replace(/[^0-9-)( ]/g, ""); $(this).val(value)});
$('#et_contact_name').keyup(function(){ var value = $(this).val().replace(/[^a-zA-Z ]/g, ""); $(this).val(value)});
$('#et_contact_subject').keyup(function(){ var value = $(this).val().replace(/[^0-9a-zA-Z-' ]/g, ""); $(this).val(value)});
$('#et_contact_message').keyup(function(){ var value = $(this).val().replace(/[^0-9a-zA-Z-/')(!@#$%&*?=;",. ]/g, ""); $(this).val(value)});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment