Scribusoid

Author Topic: javascript not working on mouse down event  (Read 89 times)

topdillon

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
  • Scribus User
javascript not working on mouse down event
« on: January 13, 2021, 06:47:27 pm »
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

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
  • Scribus User
Re: javascript not working on mouse down event
« Reply #1 on: January 14, 2021, 07:06:15 pm »
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

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
  • Scribus User
Re: javascript not working on mouse down event
« Reply #2 on: January 15, 2021, 08:18:25 pm »
...or is there something I should read?

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