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

Button lags or jumps when triggered

Participant ,
Sep 11, 2022 Sep 11, 2022

Copy link to clipboard

Copied

Hey all,

I have 'toggle button', two buttons in overlay that Add or Remove each other and other fields. For some reason, there is a lag or a miniscule jump that occurs when one is clicked. The buttons and the form are export from inDesign and clicked smoothly originally. But I've added a javascript to each and now they jump. 

On Focus, Add has: 14 field show/hides plus a short script.

Remove has 11 field show/hides and a script.

 

If it's relevant, here are the scripts :

//add button 1, onFocus//
if (internal1.display==display.visible &&
internal2.display==display.visible &&
internal3.display==display.hidden &&
((internal1.value!="Internal" &&
internal1.value!="" &&
internalTest.test(internal1.value) == false) ||
(internal2.value!="Internal" &&
internal2.value!="" &&
internalTest.test(internal2.value) == false)))
{errorInternal1.display = display.hidden;
errorInternal2.display = display.visible;
errorInternal3.display = display.hidden;}

if (activity1.display==display.visible &&
activity2.display==display.visible &&
activity3.display==display.hidden &&
((activity1.value!="Activity" &&
activity1.value!="" &&
activityTest.test(activity1.value) == false) ||
(activity2.value!="Activity" &&
activity2.value!="" &&
activityTest.test(activity2.value) == false)))
{errorActivity1.display = display.hidden;
errorActivity2.display = display.visible;
errorActivity3.display = display.hidden;}

if (project1.display==display.visible &&
project2.display==display.visible &&
project3.display==display.hidden &&
((project1.value!="Project" &&
project1.value!="" &&
projectTest.test(project1.value) == false) ||
(project2.value!="Project" &&
project2.value!="" &&
projectTest.test(project2.value) == false)))
{errorProject1.display = display.hidden;
errorProject2.display = display.visible;
errorProject3.display = display.hidden;}
 
 
//remove button 1, onFocus//
var dist2 = this.getField("Distribution 2");
var fund2 = this.getField("Fund 2");
var deptId2 = this.getField("Dept ID 2");
var account2 = this.getField("Account 2");
var project2 = this.getField("Project 2");
var activity2 = this.getField("Activity 2");
var internal2 = this.getField("Internal 2");


{dist2.textColor = color.ltGray;
dist2.strokeColor = ["RGB",0.863,0.863,0.863];
dist2.borderStyle = border.u;
fund2.textColor = color.ltGray;
fund2.strokeColor = ["RGB",0.863,0.863,0.863];
fund2.borderStyle = border.u;
deptId2.textColor = color.ltGray;
deptId2.strokeColor = ["RGB",0.863,0.863,0.863];
deptId2.borderStyle = border.u;
account2.textColor = color.ltGray;
account2.strokeColor = ["RGB",0.863,0.863,0.863];
account2.borderStyle = border.u;
project2.textColor = color.ltGray;
project2.strokeColor = ["RGB",0.863,0.863,0.863];
project2.borderStyle = border.u;
activity2.textColor = color.ltGray;
activity2.strokeColor = ["RGB",0.863,0.863,0.863];
activity2.borderStyle = border.u;
internal2.textColor = color.ltGray;
internal2.strokeColor = ["RGB",0.863,0.863,0.863];
internal2.borderStyle = border.u;}

dist2.value = "0";
fund2.value = "Fund";
deptId2.value = "Dept ID";
account2.value = "Account";
project2.value = "Project";
activity2.value = "Activity";
internal2.value = "Internal";
 
if (internal1.display==display.visible &&
internal2.display==display.hidden &&
internal3.display==display.hidden &&
(internal1.value!="Internal" &&
internal1.value!="" &&
internalTest.test(internal1.value) == false))
 
{errorInternal1.display = display.visible;
errorInternal2.display = display.hidden;
errorInternal3.display = display.hidden;}

if (activity1.display==display.visible &&
activity2.display==display.hidden &&
activity3.display==display.hidden &&
(activity1.value!="Activity" &&
activity1.value!="" &&
activityTest.test(activity1.value) == false))
{errorActivity1.display = display.visible;
errorActivity2.display = display.hidden;
errorActivity3.display = display.hidden;}

if (project1.display==display.visible &&
project2.display==display.hidden &&
project3.display==display.hidden &&
(project1.value!="Project" &&
project1.value!="" &&
projectTest.test(project1.value) == false))
{errorProject1.display = display.visible;
errorProject2.display = display.hidden;
errorProject3.display = display.hidden;}
TOPICS
JavaScript , PDF forms

Views

29

Likes

Translate

Translate

Report

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 ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

LATEST

Hi,

 

You could try placing

 

this.calculate = false;

at the start of your script and then

this.calculate = true;

 

this switches of calculations so that they don't run while you are hiding/showing your fields.

Likes

Translate

Translate

Report

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