WP Data Access supports custom validation through JavaScript and database triggers. JavaScript validation is very simple, just add a JavaScript function named pre_submit_form() to your page which handles the validation. The plugin will automatically execute your pre_submit_form() function before data is submitted to the server.
JavaScript validation example
function pre_submit_form() { 
    if ( jQuery("#check_code").length < 6 ) { 
	    alert("ERROR Check code must be at least 6 characters"); 
		return false; // this tells WP Data Access your validation failed 
	}
	// Add more validations here... 
	return true; // this tells WP Data Access your validation succeeded 
}Add pre_submit_form() to back-end page #
Use filter wpda_after_simple_form to add your validation function to a project used on the back-end. Read more…
			Example
<?php 
function my_validation_hook( $self ) {
    ?>
	<script>
	    function pre_submit_form() { 
		    // Your validation code goes here... 
			return true; 
		} </script>
    <?php
}
if ( isset( $_REQUEST['page'] ) && 'wpda_wpdp_21_24' === $_REQUEST['page'] ) {
    // Validation is added to project id 21 page 24 only 
	add_action( 'wpda_after_simple_form', 'my_validation_hook', 10, 1 );
} 
?>The premium version of the Code Manager supports back-end coding. Read more…
Add pre_submit_form() to front-end page #
Use the Code Manager (free version) for projects executed on the front-end with shortcode wpdadiehard. Just add your validation function to the page running the wpdadiehard shortcode. That’s all! Read more…
Limitations #
- JavaScript validation does not work with Data Forms.
