Hello,
I am new to Bubble, and this is my first post here. So far I am very impressed by how quickly I can got the core of my needs done.
I created an app that manages multiple custom forms. I need the Database structure to be simple (I don’t want a table for each form- since I expect I will have hundreds for different templates).
My solution is to store all the form input information in one JSON string -
This is how it looks in the DB:
The JSON string is created by JSON Generator Plugin (awesome!) and looks like this:
{“input 1”:“174”,“input 2”:“Hello \n\nWorld”,“checkbox 1”:true,“checkbox 2”:false,“checkbox 3”:true,“checkbox 4”:false,“checkbox 5”:true}
I have a workflow that runs on page load, that parse the data ( I use a regex (?:“input 2”:)(.*?)(?:,"|}) and a bunch of search&replace), and stores it into a custom state of each element. The custom state is mapped to the initial content so everytime the user loads the page the last stored information is loaded.
The whole workflow works pretty well, other than the fact that I am unable to unescape some element in the string. If you look at input 2 above it is stored as “Hello \n\nWorld” (each \n indicates ASCII Newline character) . When I reload the information into the multiline input it looks like this:
each \n became \\n (and I think this is something multiline input is doing… which makes me think the input has some protection against xss (yay!). but it can also mean that my json string is escaped (this is why the preview shows the actual characters and not newlines). I tried unescaping using search and replace (searching for \ and replacing with ) in the Initial Content Expression but it didn’t help.
Any suggestions about how to move forward will be greatly appreciated! I would love to discover that I am missing something simple
Thanks,
Eldad