Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Last active March 14, 2019 14:09
Show Gist options
  • Save propertyhive/c341b812406634bbc2a0a75b59795d72 to your computer and use it in GitHub Desktop.
Save propertyhive/c341b812406634bbc2a0a75b59795d72 to your computer and use it in GitHub Desktop.
Add custom validation to property
add_action( 'propertyhive_property_address_fields', 'add_property_address_validation' );
function add_property_address_validation()
{
?>
<script>
jQuery('.wrap form').submit(function()
{
if (jQuery(this).find('input[name=\'_address_three\']').val() == '')
{
alert('Please enter the property town/city');
return false;
}
return true; // passed validation
});
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment