Validate Frontend Textfield

This topic contains 2 reply and 3 voices, and was last updated by Daniel 10 years, 3 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
May 15, 2013 at 2:29 pm 3674
Daniel I need to validate a textfield. Only numbers. Better I can Validate every Field with Regular Expression. Does anyone have an example or a good link. Danke.Thx.
May 15, 2013 at 2:52 pm 3677
Tareq Hasan Tareq Hasan

You can use JavaScript/jQuery to validate the field. Also if you need server side validation, there is validation filters: wpuf_add_post_validate and wpuf_update_post_validate.

Example:
[php]
function my_example_validation() {
if ( isset( $_POST[‘some_field’] ) ) {
//do any validation
//if any error found, return the error message
return ‘You got some error’;
}

return ”;
}

add_filter( ‘wpuf_add_post_validate’, ‘my_example_validation’ );
[/php]

January 10, 2014 at 11:28 pm 14293
Daniel Daniel

Neither wpuf_update_post_validate nor wpuf_edit_post_validate have any effect! 🙁

Viewing 2 Posts - 1 through 2 (of 2 total)