Expand my Community achievements bar.

Need help with javascript in form.

Avatar

Level 2

I am designing a form and am struggling with implementing a if then javascript statement and am curious if there is anything this community can help me with.  Here is the scenario.

I have a drop down list called park1.

I have a numerical field called possible1.

I would like to set the dropdown, and based on what the option in the drop down is, have the possible field auto populate with a value.

Here is my javascript code, which I can find no errors in.

So if the first option, or the drop down option with a value of 1 is set in park1, it should populate possible1 with 40. and so on.

All I get when I implement this on the possible1 field, is a blank white box for possible1. It never changes and is not fillable.


Any help is appreciated. I feel like i am missing something very simple here.

Thanks,

4 Replies

Avatar

Level 6

I have accomplished this using a different javascript (change event of the droplist):

if (xfa.event.newText=="1")

{possible1.rawValue="40"

}

if (xfa.event.newText=="2")

{possible1.rawValue="40"

}

if (xfa.event.newText=="3")

{possible1.rawValue="35"

}

And so on.

Avatar

Level 2

Now was this script placed on the dropdown, or on the target field?

Avatar

Level 6

It is using the change event of the droplist.

Avatar

Level 2

Ok, thank you. I will try that and post my results.