CRED plugin provides an API, making it easy to customize your post or user forms. The API includes hooks (actions and filters) to accomplish specific tasks using PHP code.
When you ask for help or report issues, make sure to tell us all related information about your form and what you want to achieve.
Viewing 15 topics - 706 through 720 (of 732 total)
Problem: I would like to require Users to upload an image and select at least one taxonomy term in my Form.
Solution: You can make a custom field image required by editing the custom field in Toolset > Custom fields > Post fields. You can use a custom code snippet with the Forms API to validate at least one term checkbox is checked:
<?php
/**
* New custom code snippet.
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
add_filter('cred_form_validate','term_checkboxes_form_validation', 10, 2);
function term_checkboxes_form_validation( $field_data, $form_data ) {
$tax = 'app-name';
$forms = array( 15 );
$msg = 'At least one checkbox is required.';
// you should not edit below this line
// field data are field values and errors
list($fields,$errors)=$field_data;
// validate if correct CRED form ID
if ( in_array( $form_data['id'], $forms ) ) {
if ( !isset($fields[$tax]['value'][0]))
$errors[$tax] = $msg;
}
return array( $fields, $errors );
}
Problem: I would like to trigger Forms Notifications whenever Comments are submitted using native WP commenting.
Solution: Forms will not hook into the native Comment system, so there's no easy way to trigger automatic email notifications for Comments. You may find the Message module useful.