javascript not working on mouse down event

Previous topic - Next topic

topdillon

I copied this code from a forum post to disable some textboxes.
I pasted it in the 'Mouse Down' event of a button.
But it doesn't run.
I code, but not in js, so the problem might be glaring, just not to me.

var aExcept = [ "From", "To" ];

for (var i=0; i<this.numFields; i++) {
    var name = this.getNthFieldName(i);

    if (aExcept.indexOf(name) == -1) {
        var f = this.getField(name);
        if (f != null) {
            f.readOnly = true;
        }
    }
}

Also, Field format for textbox not working:
I set it to number with "$" for currency, but it accepts anything.

iMac Big Sur
Scribus 1.5.6.1

topdillon

Update:
I moved over to developing and testing on Windows 10 and that solved the textbox formatting issue.

Is my js code incorrect?
Or is there another step that I missed?
Or is my button idea a waste of time?

topdillon

...or is there something I should read?

If you are really out there and you can hear me, please show me a sign.