line break format for textboxes <br/> vs <br>

11 posts by 4 authors in: Forums > CMS Builder
Last Post: March 11, 2019   (RSS)

line break format for textboxes <br /> vs <br />

By daniel - March 5, 2019

Hi Deborah,

Fortunately, this is possible by customizing the TinyMCE configuration and adding the following option:

element_format : "html",

If you haven't already done so, you'll need to copy /lib/wysiwyg.php to create /lib/wysiwyg_custom.php, and the option will go in the configuration block following "tinyMCE.init({"

Let me know if you have any further questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

line break format for textboxes <br /> vs <br />

By Deborah - March 6, 2019

Daniel, thank you for the suggestion.

I gave it a try, but it did have a visible effect. The code written to the database (after re-saving) still recorded as <br/>. That's probably because the generated code for textboxes is written by CMSB, not TinyMCE. (I think.)

I've now discovered that editing the following in /lib/common.php accomplishes what I want.

ORGINAL CODE:
case 'textbox':
$fieldValue = $_REQUEST[$fieldPrefix.$fieldname];
if ($fieldSchema['autoFormat']) {
$fieldValue = preg_replace("/\r\n|\n/", "<br/>\n", $fieldValue); // add break tags
-----
CHANGED <br/> HERE:
$fieldValue = preg_replace("/\r\n|\n/", "<br>\n", $fieldValue); // add break tags

Thanks again for your help.

~ Deborah

line break format for textboxes <br /> vs <br />

By Dave - March 6, 2019

Hi Deborah, 

Thanks!  I've updated that in our code for the next release.

Dave Edis - Senior Developer
interactivetools.com

line break format for textboxes <br /> vs <br />

By Deborah - March 6, 2019

Dave, that will be great!

And if you feel it's time to shift to HTML5, it would be helpful to also have the Code Generator code updated...

- Line breaks from <br/> to <br> 
- Closing image tags from ' /> to '>' (no space or forward slash)
- Horizontal rule from <hr/> to <hr>
- Anything else I missed?

Not a big deal... I rarely use the line breaks or horizontal rule, but the image tags I always have to edit.

~ Deborah

line break format for textboxes <br /> vs <br />

By zaba - March 7, 2019

This is optional in html5 for self closing tags, such as

<br /> <img /> <hr />

it helps to retain them as it provides a visual clue of non-closing tags.

Why would you need to replace them, just curious?

line break format for textboxes <br /> vs <br />

By Deborah - March 7, 2019

Zaba, that's just how I prefer to code. I don't need those visual cues. A line break or horizontal rule doesn't need a closing, as there's no "start". For the img tag I like to be consistent with how I code the entire site.

It was just a request/suggestion and up to Interactive Tools to decide if their client base would want same.

~ Deborah

line break format for textboxes <br /> vs <br />

By Dave - March 7, 2019

Hi All, 

We've updated that for the next beta release. 

As zaba says it's not technically required but we like to keep the software and generated code "looking modern".  

Now I just need to remember to stop adding it myself!

Dave Edis - Senior Developer
interactivetools.com

line break format for textboxes <br /> vs <br />

By zaba - March 7, 2019

Dave, do you have any code to stop me from placing my pen at exactly 90degrees in relation to my keyboard? 😀

line break format for textboxes <br /> vs <br />

By Dave - March 11, 2019

Zaba, We actually do have a plugin in development for that, but it only works if your pen is running the latest firmware. ;-)

Dave Edis - Senior Developer
interactivetools.com