This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Disable preg_replace <br />


  1. Willy
    Member

    Hi,

    In one of my field descriptions I have a <br /> that gets removed every time I edit and save the form.
    This forces me to rewrite that <br /> every time I edit the form before saving it.

    Can you please explain me where this what I suppose is a preg_replace is done and/or how to disable it?

    Greetings.

    Posted 13 years ago #
  2. yuniar

    Hi Willy,

    What version of MachForm are you currently using?
    I suggest to update your machform to the latest version (v2.3), so that you won't need to manually write
    tag. New lines should be translated automatically to

    You can download it from customer area.


    MachForm Founder

    Posted 13 years ago #
  3. Willy
    Member

    Hi Yuniar,

    I am using 2.3.

    Maybe I should have been more specific. I am talking about the "Guidelines for user" field.

    I introduce a long description containing html. I just tried your suggestion but no <br /> is placed where I made a linebreak using enter key. I checked this viewing the source code.

    Posted 13 years ago #
  4. yuniar

    Ah... yes, you are righ. The guidelines doesn't seem to translate the new lines into break. Only the field labels does.

    The fix is very simple, edit your includes/view-functions.php file, search around line 1656 for this code:

    $element[$j]->guidelines 	= $row['element_guidelines'];

    change it to become:

    $element[$j]->guidelines 	= nl2br($row['element_guidelines']);

    that will translate the new lines into breaks.


    MachForm Founder

    Posted 13 years ago #
  5. Willy
    Member

    Thank you,

    That fixed the issue. I discovered another instance of $element[$j]->guidelines = $row['element_guidelines']; around line 1324. I changed that one too.

    Is that correct?

    Greetings.

    Posted 13 years ago #
  6. Willy
    Member

    $element[$j]->guidelines = $row['element_guidelines'];

    Posted 13 years ago #
  7. yuniar

    Yes, that is correct.


    MachForm Founder

    Posted 13 years ago #

RSS feed for this topic

Reply