What if you add the space in the text input, where you enter the text and not in the code view? You just enter your text there and you can also pick dynamic data there as well … no need to open the code view and enter text when you are supposed to just enter it in the input:
Perhaps Wappler assumes you would never want to include a space at the end of variable, any more than you would want to store a value in a database with a trailing space. I think it would be a reasonable assumption.
I can't say I agree with that... I think Wappler users are very capable of deciding where they want a space character and expecting Wappler to obey their wishes!
I’m with Tom on this…it is very common to trim white space from the ends of values to prevent issues especially common with copy/paste. The space cannot be seen and therefore becomes a nightmare to troubleshoot.
Antony’s use case remains equally valid though.
Perhaps the editor can incorporate both of these into validation. Something like trim the ends of white space, unless the user has actually hit the space key during entry?
Ya, I’m not saying this can’t be improved, only agreeing with Tom that we should not ignore the use cases other than yours. It’s above my paygrade to find the solution.
Looking at the issue and the current solution, I do agree with you to some extent. Using the method that @Teodor suggested, I think it would be better if trailing spaces were automatically removed. I wouldn’t use this method; it’s a sort of workaround for an issue that isn’t much of an issue. Also, at some point, it’s possible that Wappler will be changed, so spaces are trimmed in this situation - so people won’t rely on spaces they can’t ‘see’ - which would break the workaround.
On the other hand, if I enclosed a string in quotes, I would expect trailing spaces to be retained. However, there are alternative approaches which means I would probably never have noticed that they weren’t, at least in this situation. Perhaps it’s more of a buglet than a bug. .
I’ve just found that putting a space on the end of a string here:
Results in the space being retained when you click in the Set Value Properties area to check it is there, but removed after the Server Action is saved!
So @teodor, @george, how on earth in Wappler can I define a string with a space at the end?
I’m sure in any other language you can say:
my_string = 'A phrase ';
And your editor won’t delete the space either immediate, or sneakily when you do a file save!