cancel
Showing results for 
Search instead for 
Did you mean: 

javascript problem

Former Member
0 Kudos

Hi All,

Im designing an adobe form in SFP. The following is my scenario.

I have 3 textfields like texfield1,texfiled2,texfield3. and a dropdown box with static values like Vendortype1,2,and3.

Depending on my selection in the dropdown (Vendortype1), 2 fields like textfield1 and 2 should be displayed on form. and textfield3 should be hided

If I select Vendortype2 from dropdown, textfield3 should be displayed.

I tried doing this with javascript for few fields but couldnt.

Can some one tell how to handle this?

I have written in change event of dropdown like following but it is not working.

-


data.#subform[0].DropDownList2::change - (JavaScript, client)----


if(this.value = "Vendortype1" )

{

TextField1.presence = "Visible";

}

else

{

TextField1.presence = "Invisible" ;

}

And also do we have any refence site for scripting in Adobe Life Cycle designer? Do we have any new API for javascript to use in Adobe?

With Regards,

Ravi

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

Ravi,

Check the Adobe Help in the Designer mostly at this location C:\Program Files\Adobe\Designer 7.1\Documentation\EN. It has some good examples to begin with.

Coming to your issue, the code you have written is not perfect. Write the following code in the exit event of drop-down in JavaScript

if(this.rawValue == "Vendortype1")
{
   TextField1.presence = "visible";
   TextField2.presence = "visible";
}
else
{
   TextField1.presence = "hidden";
   TextField2.presence = "hidden";
}

Also if you want hide initially all the text fields when the form is displayed then in the form:ready event of the Main Subform at the top of hierarchy write following code in JavaScript:-

TextField1.presence = "hidden";
TextField2.presence = "hidden";
TextField3.presence = "hidden";

Chintan

Former Member
0 Kudos

Hi Chintan,

Thank you for the prompt reply. I have made changes and placed my code in exit event of dropdown and also for hiding I have placed in form:ready event of Sub form.

Now, when I execute(F8) I can see the fields are hiding but when I select the value from dropdown they are not visible..

What could be the mistake?

Regards,

Ravi

chintan_virani
Active Contributor
0 Kudos

Ravi,

Put a messagebox just before the if loop and see what value you get. Compare that value in the if loop then.

xfa.host.messageBox("Selected value is:"+this.rawValue);
if(.....)
{
 ....
}

Chintan

Former Member
0 Kudos

Chintan,

After placing the message box, when I execute it, I can see a window with the actual value selected from the drop down list , but still my textfields are not displaying in the form

Regards,

Ravi

chintan_virani
Active Contributor
0 Kudos

Ravi,

Couple of more checks:-

1.Check the case of the value.

2.Try to access the TextFields using complete hierarchy like form1.#subform[0].TextField1.presence and so on.

3. Also most importantly have you saved your form as Dynamic Form ? For this goto Edit menu option --> Select Form Properties --> Goto Defaults tab --> Check what's the preview type --> If its Print then change the Preview type to Interactive Form and XDP Preview Format to Acrobat 7.0.5 Dynamic PDF.

Chintan

Former Member
0 Kudos

Chintan,

I have checked all Case Values they are fine. Tried accessing Textfields with full hierarchy and also for making the form dynamic already settings are there.

But still not able to get the fields.

or do I have to trigger any other event apart from exit?

Regards,

Ravi

chintan_virani
Active Contributor
0 Kudos

Ravi,

Can you send me the form, so that I can take a look. You can details in my Business card.

Chintan

Former Member
0 Kudos

Hi Chintan,

I have just forwarded PDF file to your email.

Regards,

Ravi

Former Member
0 Kudos

Hi Chintan,

Thank you very much for your time. After I save form as Dynamic PDF, it is working fine.

Rewarded full points and closing the thread.

Regards,

Ravi

Answers (0)