View Full Version : [CLOSED] Can not change EmptyText

Jan 25, 2013, 9:54 PM
When you set EmptyText, it injects the old EmptyText as the text value of the textfield. It's very subtle but after you press Change Empty Text, put your cursor in the textbox.

The only workaround is to set the Empty Text and if the textfield was empty in hte first place, clear it.

<!DOCTYPE html>
<head id="Head1" runat="server">
<style type="text/css">

<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" Theme="Gray"
DisableViewState="true" />
<ext:TextField runat="server" ID="txtField" EmptyText="Initial Empty Text" Width="300">
<ext:Button runat="server" Text="Change Empty Text">
<Click Handler="#{txtField}.emptyText = 'New Empty Text';">

Jan 25, 2013, 11:11 PM

Sorry, I don't quite understand you. What's your problem?

If the problem is that you have to focus and blur textfield to show new EmptyText? You can try to call applyEmptyText

<Click Handler="#{txtField}.emptyText = 'New Empty Text'; #{txtField}.applyEmptyText(); ">

Jan 26, 2013, 3:47 AM
The empty text is not changed when you call textField.emptyText = "Some Text".

Jan 26, 2013, 3:59 AM
As far as I can know there is no any mechanism in JavaScript to get something updated just after updating a JavaScript object's property.

I mean that there is no "setter" where it would be possible to run some additional JavaScript code to update the required things.

So, calling the applyEmptyText method should be a solution.