Issues with putting a list into a text box with \n as divider
-
The issue I’m having is joining a list into a multi line text box with \n as the divider then splitting it back into the list after the user is done editing doesn’t split at \n if the text box wasn’t edited, resulting in one item that has \n in that item despite me splitting with \n as splitter, (another minor appearance issue is when \n is put in text box with set value depending on semi random circumstances, it doesn’t actually go to the new line, it just has a weird space), my current fix is the user can’t continue until they have made a change to the text box, it still works even if it’s just typing and letter and then deleting it so I just have it detect any change to the text box and then allow the option to continue.
I have tried using automation to type and delete a character and I am having difficulties getting the automation plugin to work, it may be that it can’t make a text box be selected in the project panel (using a pointer click so you’re now typing in it) and key press and key release can’t type in that panel, I try to click in a text box, (0 0 is inside the text box as it’s very big), type a letter, and delete it
PS: after testing it does appear that simulate key press (and probably key release) do only trigger the blocks which will probably be the same with simulate mouse press
-
To split some text by the new line character, you need to use ‘\\n’ instead of ‘\n’. This is often called “escaping”.
Please check out this example:
The project is shared here:https://play.creaticode.com/projects/651d97e3fc9a5a6d1489856c
-
@info-creaticode thank you for letting me know, this solves my issue, but another bug worth pointing out is that it may just be because I’m on an iPad, but the new line splitter appears to just be \n because of so when I actually type into the text box it splits it all the characters properly, after further testing I have found this, if I set it to 1 2 3 with them all on different lines properly, clicking join leaves them, if I type another letter then join, it sets it to 1 2 3 but a single line, and \n still splits them properly when removing from list
-
@tyller_ further testing it appears read only fixes the issue with inserting text but not taking out, just tested using \n with read only works properly when taking out, I have also found that if you try to separate by \ it crashes which makes sense, as of typing I have concluded, if you put in text with join \n you have to extract using \n, if you put in text using regular enter presses then you separate with \n, if you type out text like 1 2 3 on separate lines and have a list try to insert the exact same thing separated joined by \n it won’t override, if you modify the text to not be the same and join it will go to the broken state I showed where they’re on single line but interpreted as divided and you have to use \n, I’ve been toying with this and am just going to make a project demonstrating it
Edit: okay final conclusion after a little more final testing, if you just enter text and nothing happens to it, you don’t delete and retype or type something then delete it or type something or delete something, you use \n, however if you do type anything, if you type anything or delete anything in the text box, you must use \n to retrieve everything, even if it was inserted with join
-
Thank you for the thorough testing and detailed report. We will fix the issue of using “” as the splitter.
Can you please share a specific project you are working on? So that we can help make sure the join and split blocks work as expected.
-
@info-creaticode I will share it and make a set demonstration of what happens when I get time, currently I have to attend something and it’ll take about an hour or two, when I finish it and get home I’ll start making it, my testing was just changing the inputs and seeing what happens so I don’t have saves of everything
-
@info-creaticode After making the demonstration on a computer I found out the error only occurs on my iPad, (model name is iPad 7th Generation), but still it’d be useful to know when you must use \n and \n to take from list
Demonstration Project Link: https://play.creaticode.com/projects/651da265fc9a5a6d14898b19
-
@tyller_ It’s error crashed… It was working when I was typing the post, though I’m typing this on my iPad and it was really lagging since I pasted the link and started typing before it, also something to mention is CreatiCode is taking 1.2 Gb of website data on my iPad (also was taking 2.7 Gb before I cleared and safari had prompted me to give CreatiCode access to more space on my iPad) so there’s a chance there’s a memory leak (or I guess a storage/cache leak?) causing a lot of data to cache…
-
Hi, we have updated these blocks so that
- You will only need to use “\n” for both joining and splitting
- If the separator is invalid, such as “”, it will report an error in the console panel but won’t stop working
- The split block works no matter if the text in the textbox is from splitting a text or from user typing.
These updates should fix most of the issues you mentioned above. If there are other issues, please let us know.
-
@info-creaticode I just found out while working on something, (on mobile devices) inserting with \n in an input field still breaks, BUT if you press the widget quick edit button (orange button with arrows shown in editor when using widgets) it fixes it if it’s inputted already, not permanently, but it fixes the graphical bug for that insert, just letting you know there is a way to “fix” it somewhat
-
Can you please explain what you meant by “inserting with \n in an input field”? Do you mean splitting a list with “\n”? Some code or a project link would be helpful. We will make sure it does not break. Thanks
-
@info-creaticode on a mobile device if you go for example the project I made above, on the examples where it shows a list join by \n on the same line, just pressing the widget edit button should put them all on different lines properly, I think it may be the edit button reloads the widgets to add the size rescale cube in the bottom right and when it does it has to reload the text and it reloads it with \n properly used, to replicate use a mobile device (I’m on an iPad), make a project, add a multi line input text box, make a list with multiple items, join the list with \n, it should show it all on the same line, press the widget quick edit button, it should then put them all on separate lines
-
Your project has 5 parts now. Which part would reproduce this issue?
-
@info-creaticode part 2 on a mobile device, if you use a mobile device (I’m using an iPad), click see inside, go to part 2, when it splits and shows 1 2 3 as if separated by spaces, click the widget quick edit button, it should then put them all on separate lines
-
We can confirm the textbox will not handle the \n separated string on iPads as new lines at the moment. It is added to our list for future fixes. Thanks for reporting this issue.