Skip Navigation

[Resolved] Taxonmy field required

This support ticket is created 5 years, 2 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by Nigel 5 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#1331423

in a form I do not know how to make a taxonmy field required ?

[cred_field field='type-de-projet' placeholder="Type de projets" force_type='taxonomy' display='checkbox' single_select='true']
#1331447

Hi Nigel,
how can we translate the error message in this case (with wpml) ?
Thanks
Olivier

#1331525

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

You need to provide the error texts in gettext calls, so that the string becomes available for translation in WPML.

So where you set an error message you would do so something like:

$errors['wpcf-my_field'] = __('Wrong Value', 'text-domain');

Whatever you specify for the text-domain can be used to locate the string in WPML.

#1331655

ok Nigel,
thanks a lot for your answer. I will try this.
I have another question about wpml translation.
I have this code in function.php with a conditonnal redirection after submit a form :

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
    
	if ($form_data['id']==168 || $form_data['id']==79){

		if(isset($_REQUEST['wpcf-association-momentanee'])&& $_REQUEST['wpcf-collaborteur'] == 'Oui' && $_REQUEST['wpcf-association-momentanee'] == 'Oui'){
            $url = '/association-collaborateur';
        }
        if(isset($_REQUEST['wpcf-association-momentanee']) && $_REQUEST['wpcf-association-momentanee'] == 'Oui' && $_REQUEST['wpcf-collaborteur'] == 'Non'){
            $url = '/association';
        }
		if(isset($_REQUEST['wpcf-collaborteur']) && $_REQUEST['wpcf-collaborteur'] == 'Oui' && $_REQUEST['wpcf-association-momentanee'] == 'Non'){
            $url = '/collaborateur';
        }
    }
    return $url;
}

I have to change the url according to the language of the user :

$url = '/association';
#1332517

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I'm not quite sure I understand the issue.

The problem is with the tests for the values of the custom fields (e.g. wpcf-collaborteur could be "Oui" in French but could be "Yes" on English translations of the post)?

Or with what the URL should be that you are redirecting to?