These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Referencing Script Object

carolbugarin
Registered: Sep 5 2007
Posts: 21

I have a radio button group that makes other subforms visible or hidden. I would like to put the JavaScript in the Script Object so I can use it in more than one location. Below is a sample of the JavaScript I use.

if(this.rawValue==0)
{Subform1.presence="hidden";
Subform2.presence="hidden";}

if(this.rawValue==1)
{Subform1.presence="visible";
Subform2.presence="hidden";}

if(this.rawValue==2)
{Subform1.presence="hidden";
Subform2.presence="visible";}

My problem is that I am not a programmer and have spent about a week trying to figure this out on my own. I need to know what I need to change and the additional JavaScript code that I need in the Script Object and the Radio Button Group to make this scenario work.

Any help would be greatly appreciated.

Thanks

Carol

My Product Information:
LiveCycle Designer, Windows
xrum
Registered: Feb 25 2009
Posts: 124
you reference the sciptobject by it's name. i.e.

if you called it ValidationScripts and the function you need to call is names isNumeric

then, in your object code you'd call it like so: ValidationScripts.isNumeric
carolbugarin
Registered: Sep 5 2007
Posts: 21
As per your example I added the following line in DocReady for the Radio Button group.

ValidationScripts.isNumeric;

I named the script object ValidationScripts.

This did not work.
I seem to be missing something.
xrum
Registered: Feb 25 2009
Posts: 124
did you make a function called isNumeric?

when you say nothing happened, did you assign the return value of that isNumeric function to something?


can you attach a sample form please
carolbugarin
Registered: Sep 5 2007
Posts: 21
Sorry no I did not make a function called isNumeric.

Can you type out the code that I need and tell me where it should go? (I'm not a programer)

I can send you a sample form. I do not know if there is a way to attach it to this post.
xrum
Registered: Feb 25 2009
Posts: 124
what do you want yoru function to do? the one that you want to reuse in multiple objects?
carolbugarin
Registered: Sep 5 2007
Posts: 21
I want it to hide or make visible subforms depending upon the selection from the radio button list. The example of the code is in the first post.

I can put the information in the docready or change for that radio button and it works perfectly but I would like it only in one location that's why I thought the script object would be better.
xrum
Registered: Feb 25 2009
Posts: 124
but if you put it in the forms docready, isn't it already in one location?
carolbugarin
Registered: Sep 5 2007
Posts: 21
The DocReady sets the form to not show any subforms if nothing is selected (new or blank form) and will show the subforms if one of the buttons is selected on a previously saved form. I need to also have the same information in Change incase a previously saved form changes.

Having the same information in both DocReady and Change is the only way I have been able to have the correct subforms appear depending upon the radio buttons.