Expand my Community achievements bar.

SOLVED

adobe livecycle pdf form

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Level 7

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"

}

View solution in original post

11 Replies

Avatar

Level 7

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;

Avatar

Level 3

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

Level 7

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

Level 3

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

Level 3

for more clear-

if A = mango

B= banana

,

if A = apple

B= orange

if A = water melon

B= coconut

thanks

Ali

Avatar

Level 7

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

Level 7

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

Avatar

Correct answer by
Level 7

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"

}

Avatar

Level 7

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