-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
form:textarea doesn't retain linebreaks #2
Comments
Good bug! What if the normalized versions were used only for the comparisons? A new textarea template with both original and normalized variables:
And the postback template modified to allow normalization to be set to "no" (is "yes" by default):
Does that do the trick? If I'm honest, I can't really remember why I normalize in the first place... |
Nice one—I think that should do the trick. My only worry is if you're comparing the two normalised values for deciding whether the
Would normalise to the same as:
Right? I imagine you were normalising as a "just in case" check, it's certainly possible that a textformatter would introduce some difference in whitespace while passing the initial value into the form. Perhaps we could include the same param in the |
I can't imagine any reason to do this in form-controls. |
It is definitely required. It has been there since the very first version (I've been using various versions of this for 18 months) and is required certainly for select boxes. Perhaps it was if the HTML contained breaks:
I suppose the only field that needs this is the textarea since it's the only one that accepts multi-line input. So it shouldn't really be an option, but hidden complexity within the template that the developer need not worry about. Max, if you remove the normalization for the textarea, does it still work? I'm trying to remember the use cases where I needed normalize-space for desired behaviour. |
Yup, still works. I have mine setup to normalize for the check if |
Cool. Do you think it's an acceptable compromise to go into the next release for textareas? |
For sure. Integrate away. |
This bug were fixed and integrated? |
Tested locally, but never pushed to Github. It's on my to-do list :-) |
Nick, started using this for a new project. Really great stuff.
I've come across one limitation thus far which is that the
form:textarea
template doesn't retain the linebreaks when populating the value. It's happening because of thenormalize-space
functions use there, and is easily fixed by changing:to:
However that causes there to be a discrepancy between the
$postback-value
and the$initial-value
. Not sure of the best way to get around that—perhaps adding a param to theform:postback-value
template to allow the non-normalised value to be returned?The text was updated successfully, but these errors were encountered: