adobe livecycle pdf form

Avatar

Avatar

Ali_Haider_shib

Avatar

Ali_Haider_shib

Ali_Haider_shib

04-03-2015

hi,

i have a pdf form made by adobe livecycle designer. here there r 2 fields. say one field A and anothe is B . i want to populate info in field b which will depend on value of A. IF i put 4 in A then B will 17., if A 5 B 21 .... etc. can u pls help to make such tye of code?

thanks

Ali

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

mouslander

Avatar

mouslander

mouslander

04-03-2015

Sorry my mistake. Here is the corrected code. you only need this on the first field. I had excluded the .rawValue

if(this.rawValue == "apple"){

fieldB.rawValue = "Orange"

}

else

if(this.rawValue == "water melon"){

fieldB.rawValue = "coconut"

}

Answers (10)

Answers (10)

Avatar

Avatar

mouslander

Avatar

mouslander

mouslander

04-03-2015

Remember that apple, orange etc are literals so if they are not entered exactly as typed it will not work. You can do this better with a drop-list where a user picks from the list and then gets a result. For example if you wanted a drop down list of fruit for example apple, orange, grapes, etc. When the user picks this the field would have corresponding info in the next field. Maybe color so pick Apple get Red

Avatar

Avatar

Ali_Haider_shib

Avatar

Ali_Haider_shib

Ali_Haider_shib

04-03-2015

thanks a lot. now working.

Avatar

Avatar

mouslander

Avatar

mouslander

mouslander

04-03-2015

I cannot get to dropbox due to security on my machine. Please send it to my email at mousland@gmail.com

Avatar

Avatar

Ali_Haider_shib

Avatar

Ali_Haider_shib

Ali_Haider_shib

04-03-2015

pls see this file. it is not working-

Dropbox - Untitled1.pdf

Avatar

Avatar

mouslander

Avatar

mouslander

mouslander

04-03-2015

so this gets a bit more complex but still fairly easy

On the exit event you would write:

if(this.rawValue == "apple"){

fieldB = "Orange"

}

else

if(this.rawValue == "water melon"){

fieldB = "coconut"

}

this is fine for a couple items. You may need to consider another mechanism if you are going to have to manage a more complex list.

Avatar

Avatar

Ali_Haider_shib

Avatar

Ali_Haider_shib

Ali_Haider_shib

04-03-2015

for more clear-

if A = mango

B= banana

,

if A = apple

B= orange

if A = water melon

B= coconut

thanks

Ali

Avatar

Avatar

Ali_Haider_shib

Avatar

Ali_Haider_shib

Ali_Haider_shib

04-03-2015

and also like so on. say apple for orange, bread for biscuit etc. i mean ont only one items. for more than 1 items.

thanks

Ali

Avatar

Avatar

mouslander

Avatar

mouslander

mouslander

04-03-2015

ok. then the script you could use would be similar

So if you want this to occur after the first field has a value you would put this on the exit event for the first field.

fieldB.rawValue = "Mango"

What will happen is upon leaving the first field the script will run and populate the second field with Mango

Avatar

Avatar

Ali_Haider_shib

Avatar

Ali_Haider_shib

Ali_Haider_shib

04-03-2015

hi,

thanks a lot for ur response. here no specific numerical relation. for a specific number it will auto populate anther specific number. but no relation between then. u can think if i put "mango " in A then Banana in B.

thanks

Ali

Avatar

Avatar

mouslander

Avatar

mouslander

mouslander

04-03-2015

if you have the 2 fields fieldA and fieldB and you want fieldB to get a value from fieldA and add to it you would write something like this on fieldB

this.rawValue = fieldA.rawValue + 9;

Note: this will only work this way if fieldA and fieldB are numerical fields if not use the following

this.rawValue = Number(fieldA.rawValue) + 9;