Skip Navigation

[Closed] Required="true" is not working

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 4 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1916933

Hello, I am trying to make all fields on the form required, so I added required="true" however it is not working on all fields. It only works on Name, Email, Message however not on Booked Extension (name) or Tours name.

I also tried adding a custom code (see below) but it still doesn't work.

add_filter('cred_form_validate','form_field_validation', 2, 10);
function form_field_validation( $field_data, $form_data ) {
// field data are field values and errors
list($fields,$errors)=$field_data;

// validate if specific CRED form ID
if ( $form_data['id'] == 308 ) {

// set error message per field
if ( $fields['booked-extensions']['value'] == '' )
$errors['text-field'] = 'This field is required.';

}
return array( $fields, $errors );
}

Please let me know how to fix this issue. Thank you.

#1917051

Hello,

How do you setup the custom fields "Booked Extension (name)" and "Tours name"? with Toolset Types plugin?
please take a screenshot for them, I need to test it in my localhost, thanks

#1917055
Screen Shot 2021-01-25 at 2.28.20 PM.png

It's using Post Forms. Here is the screenshot on booked extension/

#1917087

I assume we are talking about some custom fields created with Toolset Types plugin.

Please try these:
Dashboard-> Toolset-> Custom Fields Group, find and edit those two custom fields: "Booked Extension (name)" and "Tours name"
Take a screenshot for them, I need to duplicate the same problem, and debug in my localhost, thanks

#1917105

Hello, thank you so much for your assistance. I now figured it out after checking Dashboard-> Toolset-> Custom Fields Group.

#1917109

Can you take a screenshot for those custom fields settings?
If you still need more assistance for it, please provide your website credentials in below private message box, I need to test your custom codes and debug them in a live website.

Private message box enabled, please point out the problem page URL and form URL, where I can edit you custom PHP codes.

The topic ‘[Closed] Required="true" is not working’ is closed to new replies.