1129

A special welcome to our newest member, Humble-Servant.

Compose Reply

Created Modules do not save line breaks into Database?

#1
5 Mar 2025, 5:49am UTC
Wednesday 5th March 2025, at 5:49am UTC
Status: Resolved
Greetings all, Hope all is well.
some information, I am using latest Trongate that has Pages.
Problem, I create a new module with desktop app and it does what I want, makes everything okay. The thing is when I save a new or update data in a module the data in database is always striped of line breaks from the data I just inserted into database.
Here is the rub, I create a page through the pages module and it saves the data text format and has the line breaks.
Am I doing something wrong? Or does making your own module take out line breaks now?
Sample:
what I insert,

The brown fox runs,
The brown fox runs fast,

What goes into database,
The brown fox runs,The brown fox runs fast,

Any ideas what's going on?
This post was liked by; DaFa
#2
15 Mar 2025, 6:58am UTC
Saturday 15th March 2025, at 6:58am UTC
Hi Tom, apologies for the delay been a bit side tracked. Will have a look at this for you soon.
#3
16 Mar 2025, 12:22am UTC
Sunday 16th March 2025, at 12:22am UTC
hmm, I just had a quick look at the SQL dump again and your controller code. When editing in Pages and adding new lines to the lyrics it wraps a <p> tag to each new line but when you edit in a text field from a Desktop-created module it uses which seems to be filtering out new lines.

Here is a quick patch you can apply to get around this until we can work out a more sensible fix:just add it after the `get_data_from_post()` or you can choose to write the raw data to the database and add nl2br() before displaying it back into the view.

Hope this helps

Cheers,
Si
Edited on Sunday 16th March 2025, at 5:22am UTC
#4
16 Mar 2025, 6:18pm UTC
Sunday 16th March 2025, at 6:18pm UTC
Thanks DaFa, the fix worked, I'll be waiting for the Trongate update to fix this. Appreciate all the work being done here!
×