[Resolved] Split: Registering Users by front end form – make required field
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hi Minesh, thank you for the answer. Q1 is solved. I have deactivated all unnecessary plugins. Used a standard theme. And creating an account now works.
So now Q2. To make some fields required. I use the expert mode of the form editor. And then:
<div class="form-group">
<label for="%%FORM_ID%%_first_name">[cred_i18n name='first_name-label']First name *[/cred_i18n]</label>
[cred_field field='first_name' class='form-control' output='bootstrap' required='true']
</div>
Code found here: https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_field
But if I leave the field empty, it still is submitted.
You can see it here: hidden link
Hello. Thank you for contacting the Toolset support.
Can you please share admin access details and let me review whats going wrong with your setup.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Hi Minesh, thank you for help.
With the code provided I can still make an account without filling First en Last name.
When I change $form_id = 0; to $form_id = 3803; (My USerform ID number) still the same.
And when I use this code:
add_filter('cred_filter_field_before_add_to_form', 'required_user_fields_func', 10, 2);
function required_user_fields_func($field, $computed_values){
if(in_array($field['id'], array('first_name', 'last_name'))){
$field['data'] = is_array($field['data']) ? $field['data'] : array();
$field['data']['validate']['required'] = array (
'active' => 1,
'value' => 1,
'message' => 'This field is required'
);
}
return $field;
}
It's the same.
With all 3 I can make an account without any required field filling.
Hi Minesh,
I added the code in the functions.php from my child theme. I have send you the credentials already, and the site is a copy of the live site. So feel free to check my setup.
Kind regards,
Corine
Hi Minesh, thank you so much! Your totaly right about the child theme. Excuse! It is working now. Kind regards,
Corine
corineV confirmed that the issue was resolved on 2024-02-15 09:26:46.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.