[Pas2js] fieldset (or other tag) change the disabled attribute

Michael Van Canneyt michael at freepascal.org
Tue Sep 13 17:15:25 CEST 2022



On Tue, 13 Sep 2022, Luca Olivetti wrote:

> El 13/9/22 a les 16:33, Michael Van Canneyt ha escrit:
>> 
>> 
>> 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 tried that, and it doesn't work.
> I want to disable the disabled, neither setting it to '0' or to 'false' works 
> (i.e. the form is still disabled).
> The other way round works though (i.e. I don't put the disabled in the html 
> and set it to '1' in code).
> Strange.

not strange. The attribute/property is there (regardless of the value), or it is not, you must use undefined
if you wish to remove it:

El['disabled']:=undefined;

Michael.


More information about the Pas2js mailing list