[Pas2js] fieldset (or other tag) change the disabled attribute
Michael Van Canneyt
michael at freepascal.org
Tue Sep 13 16:33:57 CEST 2022
On Tue, 13 Sep 2022, Luca Olivetti wrote:
> Hello,
>
> the bulma documentation says that you can disable a form partially or totally
> by enclosing the fields to be disabled in a
>
> <fieldset disabled></fieldset>
>
> tag.
>
> I could find no way to change the disabled using the classes in htmlwidgets,
> I couldn't find a TJSHTMLFieldSet and TJSHTMLElement has no disabled
> attribute.
You can access ALL attributes using the properties property of TJSObject.
So if 'El' is your object instance then you can set disabled:
El.Properties['disabled']:='1';
it is also the default property so the following also works:
El['disabled']:='1';
>
> I cast it to a TJSHTMLButtonElement and it works, but, meh, I don't like it.
>
> I added a "disabled" field to TJSHTMLElement (and removed it from all other
> descendant) and it also works.
>
>
> I also don't like to have some elements using htmlwidgets and other elements
> using TJS*.
>
> Is there a better, proper, way?
The correct way is to introduce TJSHTMLFieldSet and declare the disabled
property. As long as that class does not exist, see above.
Michael.
More information about the Pas2js
mailing list