Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

add script

Explorer ,
Dec 30, 2024 Dec 30, 2024

I have a lot of checkboxes, I want to add on focus script to all the checkboxes, is there a way to automate this?

TOPICS
JavaScript
357
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Dec 30, 2024 Dec 30, 2024

You can use this in a button or run from console:

for(var i=0; i<this.numFields; i++){
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if(f==null) continue;
if(f.type=="checkbox") f.setAction("OnFocus", "Put your script here");}

In your script, use single quotes or escape quotes with backslash.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 30, 2024 Dec 30, 2024

You can use this in a button or run from console:

for(var i=0; i<this.numFields; i++){
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if(f==null) continue;
if(f.type=="checkbox") f.setAction("OnFocus", "Put your script here");}

In your script, use single quotes or escape quotes with backslash.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 30, 2024 Dec 30, 2024
LATEST

Nice work!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines