[Pas2js] how to get text content from TTextInputWidget
Jean SUZINEAU
Jean.Suzineau at wanadoo.fr
Sat Aug 29 15:18:25 CEST 2020
Michael replied before me, I send my message anyway...
Le 29/08/2020 à 14:16, Mgr. Janusz Chmiel a écrit :
> I Am getting error:
> Error: Can't access protected member Text
> when I have declared on1 as string;
> and when I type
> on1:=o1.text;
> o1 is The TTextInputWidget variable.
> So how to get text correctly?
>
> _______________________________________________
> Pas2js maillist - Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
I didn't try but according to the source TCustomInputWidget.Text gives
you the "inner text" of the input tag (the input widget is based on the
"input" html tag).
TCustomInputWidget.Text is declared as "protected" so it can only be
accessed from the inside of the class definition.
It's not redefined in sub class TTextInputWidget which inherits from
TCustomInputWidget so you can't access it.
A quick way to access it would be to declare your own subclass:
type
TMyTextInputWidget
=
class(TTextInputWidget )
published
Property Text;
end;
This way you'll be able to access the text property if you use
TMyTextInputWidget instead of TTextInputWidget .
But I doubt it will be useful. I you use the html just below, you'll see
what is the "value" and the "innertext" of the html tag.
I think what you are searching for is the value, not the inner text of
the tag.
<html>
<body>
<input value="value">innertext</input>
</body>
</html>
More information about the Pas2js
mailing list