Need help about DtextEntry , about how to detect if the textfield is empty

Hi everyone, I search a way how to find OnLoseFocus if the textfield is empty

If someone one can help me.

I have maybe a solution but i’m not sure how to use it ,
I think with

DTextEntry:OnKeyCodeTyped( Integer code )

in example if no keycode typed then do get first value set

any one ?

P.S: is there a place to find some keycode for this one too ?

Thanks in advance.

You could always use DTextEntry:GetValue() and check to see if it’s empty(Just an empty string).

DTextEntry.OnLoseFocus = function(PanelVar)
  if (DTextEntry:GetValue() == "") then 
    print("Has text!")

I tried this but maybe I get this wrong on try.

and when you mean

DTextEntry:GetValue() == ""

if I have another text in the value like

"Enter Value" or ""

Do I need to write like this

DTextEntry.OnLoseFocus = function(PanelVar)
  if (DTextEntry:GetValue() == "" or DTextEntry:GetValue() == "Enter Value" ) then 
    print("Empty!" or "you have not changed anything!")
    print("Has text!")

and just a small other thing if I have more than one space in the value like this

(DTextEntry:GetValue() == "    " )

do I get the result of the value empty too ?

Use string.find(str, “[^%s]”)

You can also use %S instead of [^%s], and this also applies for each other character case.