Why no cuetext for a TextArea?

I have no idea.

But you can create a cue by entering a default text with a lighter color that will be deleted at the first keydown.

if cuegone = false then me.text = "" cuegone = true me.Textcolor = &c000000 end if

cuegone is a boolean public property false as default that acts as a flag

Thanks that will work. But it creates problems with field validation and accidentally shoving example data into the database.


Other approach :

Place a transparent label with grey cue text over the TextArea. In the label MouseDown :

Me.Visible = False TextArea.Setfocus

In the TextArea KeyDown :

if cuegone = false then Label1.visible = False cuegone = true end if

cuegone is a boolean public property false as default that acts as a flag

You can restore Label1.Visible and cuegone = False when the TextArea.Text is empty without risk of interference from the cue text.

Heads up that using MouseDown means that the user has to wait for a server round trip before they can use the field.

Workaround (also in Feedback)

Sub Shown() Handles Shown
  dim sPlaceholder as String = "Do not overlap controls on Web."
  ExecuteJavaScript("document.getElementById('" + me.ControlID + "_inner').placeholder = '" + sPlaceholder + "';")
End Sub

I dont think that’ll work in desktop/ios Tim :frowning:

This thread is specific to Web, the feedback case is not.
Noted it’s a web specific workaround in feedback now :slight_smile:

In that case, I would recommend a canvas to hold the cue, since at least on Mac and iOS it does not hinder clicks or prevent to type.

Why not just add a property CueText and a boolean, to a subclass of TextArea? In the TextChange determine whether or not to show it using the boolean, and whether or not to use it in the database (again using the boolean)