Line Breaks In Text Input Database Field

Line Breaks In Text Input Database Field

by J W -
Number of replies: 5

In my add entry template I have a html table which contains rows of database text input fields.

I see that when adding a record I am not able to paste in excel data with line breaks.

It only pastes as a single line of text with a space between cells

Is there a way i can format the database fields to allow this using CSS or JavaScript?

Thanks

Average of ratings: -
In reply to J W

Re: Line Breaks In Text Input Database Field

by William Lu -
Picture of Particularly helpful Moodlers
Yes, the Database has the CSS and JavaScript templates.
You can also add Scripts into the List/Single/Add template straightaway.


In reply to William Lu

Re: Line Breaks In Text Input Database Field

by J W -
I appreciate the response but i have already been trying to make this working using the CSS and JS tabs and have not been able to. I am not very familiar with JS so i have been researching ways to achieve this online but the implementation of these scripts appears to escape me.

All i need to do is paste some data copied from excel into a database 'text input' field and keep its formatting when displayed in the single view.

Currently only a single line is allowed in the text input

I have tried multiple options to achieve this but would like some assistance if possible.

Thanks.
In reply to J W

Re: Line Breaks In Text Input Database Field

by William Lu -
Picture of Particularly helpful Moodlers

I've tested the copy/paste from Excel table into the "Textarea field"


The table is saved and displayed without any problem.

Why do you use the "Text field"? It is for single line content only.

In reply to William Lu

Re: Line Breaks In Text Input Database Field

by J W -
i am using text input fields because i do not want my users to have access to format the information after pasting it in. I really only need a box for them to paste into that keeps formatting but does not allow them to see the editor at the top of the textarea. is there a way i can disable the editor for a single group of users?
In reply to J W

Re: Line Breaks In Text Input Database Field

by William Lu -
Picture of Particularly helpful Moodlers
How about you ask your students to take a screenshot of their spreadsheet then upload it? Or you can ask them to upload their excel file.