I noticed an issue that other plugin users in the past have experienced with the form message about “required fields” displaying the following HTML code:
Fields marked with an <span class="ninja-forms-req-symbol">*</span> are required
We have upgraded to 3.8.3 and cleared our web cache to see if these issues would resolve, but it’s still visible.
Hello @sparkwebmaster, thank you for reaching out about your concern with the plugin. Faisal shared a workaround devised by someone, but there is also another workaround that is a bit more technical. You can hide the required field via CSS then at the top of the form, you can add a HTML field and write code such as the following: <p>Fields marked with an <span class="req-symbol">*</span> are required</p> in which you can use CSS to target the req-symbol class name. These two suggestions will work until the Ninja Forms has a fix. Hope this helps!
I found another workaround provided by @vreemt. You can try the following code snippet in your child theme’s functions.php file or use the Code Snippets plugin.
If you opt for the plugin, navigate to Code Snippets → Add New, insert your code, and choose additional options as shown in the screenshot below.
Code:
add_filter( 'ninja_forms_i18n_front_end', 'my_custom_ninja_forms_i18n_front_end' );
function my_custom_ninja_forms_i18n_front_end( $strings ) {
$strings['fieldsMarkedRequired'] = 'Fields marked with an <span class="ninja-forms-req-symbol">*</span> are required';
return $strings;
}
Now the issue should be resolved, and the text will display as before. Feel free to make any modifications to personalize your message.
I’m not sure why this is marked as resolved – it isn’t. Adding a filter work-around isn’t a fix. Are the plugin developers going to chime in on this bug?
I use ninja wpcasa addon for ninja forms and nothing worked for me. This plugin uses do_shortcode() for outputting of ninja form. Weird thing was that it worked in theme.php or with direct inserting into content (post) – maybe because they use action “template_redirect”to place form in different positions on page. After digging in ninja code I found that they use esc_html() for some strings/settings – and default settings (from lan file) was there too: ‘fieldsMarkedRequired’ – it is in file includes/Display/Render.php
There is filter, so after using this:
function decode_ninja_forms_display_form_settings($settings, $form_id) { $settings['fieldsMarkedRequired'] = html_entity_decode($settings['fieldsMarkedRequired']);
Need an official fix for this. I am not doing a work-around. This is a pretty basic function of the plugin and it displays poorly in all forms with a required field. Please fix ASAP. Thank you!
Viewing 9 replies - 1 through 9 (of 9 total)
The topic ‘HTML code showing for the fields required form message’ is closed to new replies.