-
7 Feb 2012 9:58 AM #1
TextArea with grow sizes incorrectly based on the value of the TextArea
TextArea with grow sizes incorrectly based on the value of the TextArea
If the user types something into the text area that has a tag that can render as HTML, then the sizer is all screwy.
For instance, the user types the following into the text area:
Then only 7 characters are processed for length as everything between the < and > are ignored.I am < Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus aliquet accumsan nunc, eget luctus arcu aliquam sit amet. Etiam feugiat quam eget nisi fringilla at fringilla neque consequat. Proin nisl nisl, rutrum ut cursus consequat, posuere quis lorem. Donec massa ligula, tempus quis placerat vel, bibendum a ligula. Sed nibh nulla, fermentum at fringilla eu, molestie vel nulla. Sed quam justo, auctor eget hendrerit et, mollis et libero. Duis ac ipsum mi, ac malesuada neque. but am > 7
A good fix would be to change Ext.layout.component.field.TextArea where it pulls the value from the input element. That value is already processed by the adjustForGrow routine to replace line feeds with <br/>. Additional processing to replace the < and > characters would fix the problem.
-
7 Feb 2012 1:11 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,678
- Vote Rating
- 435
What Ext JS 4 version are you seeing this in and what browser? Just tested in Chrome with out latest code and the textarea grows as expected.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
7 Feb 2012 1:20 PM #3
EXT 4.0.7 and Chrome 16.0.912.77
It depends what you type to get the grow to not work. If you have a bunch of text within a <> then it will not grow appropriately. My example might have been off, the content between the <> in my case has no white space, which could make the difference.
-
7 Feb 2012 1:32 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,678
- Vote Rating
- 435
This produced this bug:
I am <Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus aliquet accumsan nunc, eget luctus arcu aliquam sit amet. Etiam feugiat quam eget nisi fringilla at fringilla neque consequat. Proin nisl nisl, rutrum ut cursus consequat, posuere quis lorem. Donec massa ligula, tempus quis placerat vel, bibendum a ligula. Sed nibh nulla, fermentum at fringilla eu, molestie vel nulla. Sed quam justo, auctor eget hendrerit et, mollis et libero. Duis ac ipsum mi, ac malesuada neque. but am> 7Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
7 Feb 2012 1:34 PM #5
I can see how that makes sense. It sends the text off to TextMetrics to measure it, which could cause problems if the markup is invalid.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
8 Feb 2012 3:01 AM #6
My fix was to add the following lines to Ext.layout.component.field.TextArea
value = value.replace (/</g, '_');
value = value.replace (/>/g, '_');
I put them right before the existing line of:
value = value.replace(/\n/g, '<br>');
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-5300
in
TBD.


Reply With Quote