• Resolved jjcstudios

    (@jjcstudios)


    I have a text field and I am trying to add a line break. I have tried a hard return and <br> and <br/> but it is not showing up on the front end?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @jjcstudios,

    By Text field, I suppose you are referring to the “Input” field. Just to be sure you want to add a line break only inside the “Label” of the field?

    By default, due to security any HTML tags added to Input fields “Label”, “Description,” etc will get removed.

    Could you please confirm where you are looking to add line breaks ie inside “Label”, “Descriptions” etc so that we could check for any workarounds?

    Looking forward to your response.

    Kind Regards,

    Nithin

    Thread Starter jjcstudios

    (@jjcstudios)

    Hi Nithin, It would be inside the default value field.

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @jjcstudios,

    Thanks for explaining further. In this case, the “TextArea” field would be much better to use instead of the “Input” field. Any specific reason to use the “Input” field?

    I suppose you are looking to manually style the text for “Default Value”?I’m checking with our developer to see if there is any workaround that could be suggested to allow HTML tags.

    Will keep you posted once we get further feedback asap.

    Kind Regards,

    Nithin

    Thread Starter jjcstudios

    (@jjcstudios)

    Thank you Nithin. I am trying to use your form as a front end text editor. Where I can put text in that area and let the user make changes to the text and then submit to me. Unless you recommend another plug-in that can do this.

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @jjcstudios,

    You can try this snippet and see whether it helps:

    <?php
    
    add_filter( 'forminator_field_text_markup', 'wpmudev_render_textarea_break', 10, 2 );
    function wpmudev_render_textarea_break( $html, $field ) {
    	if ( strpos( $html, '{line_br}' ) !== false ) {
    		$html = str_replace('{line_br}', '
    ', $html);
    	}
    	return $html;
    }

    The above code can be added as a mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Once the code is added you’ll need to add {line_br} for linebreak:

    Screenshot at 09:59:37.png

    Please do note that the above snippet will only work for “TextArea” field.

    Kind Regards,

    Nithin

    Thread Starter jjcstudios

    (@jjcstudios)

    That worked perfectly!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Line break’ is closed to new replies.