Ready to get started?Download WordPress


[Plugin: Contact Form 7] textarea with multi paragraph default (4 posts)

  1. thecoup
    Posted 6 years ago #

    Is it possible to have a textarea with default text that includes multiple paragraphs?

    <p><label>Edit the letter:<br />
        [textarea* your-message 24x3 "Dear Senator,
    Please vote no.
    I think our tax money could be better spent in other ways.
    Sincerely," ] </label></p>

    WP inserts <p> and everything becomes a mess. Oddly, the textarea also includes the opening and closing quotes.

    Any suggestions?

  2. xondie
    Posted 5 years ago #

    Does this mean that there is no solution to this problem? I have been searching for hours for some solution to this and have found nothing. Not even anyone saying it can't be done. Just radio silence.

    Any insight is appreciated.

  3. xondie
    Posted 5 years ago #

    I don't know if this is the best solution, but I've found something that works for me. In involves a code change in dd-formmailer.php

    in the function ddfm_gen_widetextarea and/or ddfm_gen_textarea, find the lines that say:

    if ($form_submitted) {
    $gen .= ddfm_bsafe($form_input[$item['fieldname']]);
    } else if (isset($item['default'])) {
    $gen .= ddfm_bsafe($item['default']);

    and replace it with something such as this:
    if ($form_submitted) {
    $gen .= str_replace('{para}',"\n\n",ddfm_bsafe($form_input[$item['fieldname']]));
    } else if (isset($item['default'])) {
    $gen .= str_replace('{para}',"\n\n",ddfm_bsafe($item['default']));

    This does a string replace on the text area text. Wherever you would like a paragraph to show up, you need to put {para} in the configuration for that text area or wide text area.

  4. thecoup
    Posted 5 years ago #

    I haven't checked to see if new versions of the plugin have resolved this. I do know, however, that the plugin is otherwise very solid and constantly improving.

Topic Closed

This topic has been closed to new replies.

About this Topic