JavaScript for an Acroform
- or -
Post a project like this2241
$$
- Posted:
- Proposals: 2
- Remote
- #1903799
- Awarded
Description
Experience Level: Intermediate
I need a script to change field display using the setInterval function.
For example... I want an action from one field to change the display on another field from display.hidden to display.noPrint for two seconds.... then change it back to display.hidden.
I found this online. This gets most of the way there-
A timed interval has two components, an interval time and a script to run when the interval expires.
this.oTimerId = app.setInterval("var oFld = this.getField('myField'); oFld.fillColor = color.equal(oFld.fillColor,color.white)?color.red:color.white;",300);
This line of code runs a script that toggles the field backgrouind color between white and red every 300 miliseconds.
To turn it off you have to run this code:
app.clearInterval(this.oTimerId);
Here's a full script to put in a button
//*************************
if(this.oTimerID)
{
app.clearInterval(this.oTimerID);
this.oTimerID = null;
this.getField('myField').fillColor = color.white
}
else
this.oTimerID = app.setInterval("var oFld = this.getField('myField'); oFld.fillColor = color.equal(oFld.fillColor,color.white)?color.red:color.white;",300);
For example... I want an action from one field to change the display on another field from display.hidden to display.noPrint for two seconds.... then change it back to display.hidden.
I found this online. This gets most of the way there-
A timed interval has two components, an interval time and a script to run when the interval expires.
this.oTimerId = app.setInterval("var oFld = this.getField('myField'); oFld.fillColor = color.equal(oFld.fillColor,color.white)?color.red:color.white;",300);
This line of code runs a script that toggles the field backgrouind color between white and red every 300 miliseconds.
To turn it off you have to run this code:
app.clearInterval(this.oTimerId);
Here's a full script to put in a button
//*************************
if(this.oTimerID)
{
app.clearInterval(this.oTimerID);
this.oTimerID = null;
this.getField('myField').fillColor = color.white
}
else
this.oTimerID = app.setInterval("var oFld = this.getField('myField'); oFld.fillColor = color.equal(oFld.fillColor,color.white)?color.red:color.white;",300);
Mike G.
100% (22)Projects Completed
15
Freelancers worked with
15
Projects awarded
71%
Last project
5 Aug 2023
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies