PDA

View Full Version : [CLOSED] textField - emptyText



Z
Apr 11, 2022, 4:40 AM
Hi

can we style the emptyText of a textField? I want the words "Where" to be bolded.



<ext-textField id="testId" emptyText="Where... at the beach"/>


Thanks
/Z

fabricio.murta
Apr 12, 2022, 12:00 AM
Hello @Z!

No, it is not possible to style the emptyText contents. It relies in HTML5 input's placeholder attribute (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-placeholder) and it, natively, does not support styling at all. Take a look at the official notes about the attribute for potentially helpful hints on how is its intended use and how much one should rely on it.

Besides, when displayed in some browser versions that don't support the attribute, it may set the own field's value to emulate the functionality, thus also ignoring HTML codes. This is stated in Ext JS's documentation for Ext.form.field.Text.emptyText (https://docs.sencha.com/extjs/7.3.1/classic/Ext.form.field.Text.html#cfg-emptyText).

Hope this helps!

Z
Apr 12, 2022, 4:21 AM
Thank you
/Z