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

Changing value of number field with change in drop-down list

rwherman
Registered: Feb 16 2009
Posts: 6
Answered

As with a lot of post I've seen on here, I'm new to Adobe LiveCycle. I've been trying to figure out for a while how to change the value in a number field depending what is selected in drop-down list. I believe it has something to do with the xfa.event.newText but haven't been able to figure it out. and for that matter don't even know if that is correct.

Basically I have two options in a drop-down list called "Budget", say they are Option1 and Option2. If Budget equals Option1 then change the value of NumberField to 8, if Budget equals Option2 then change NumberField to 4. This is what I've tried based on the information I found online, but really don't know if I'm even on the right track.

----- Document.MainForm.PaymentPlans.Payments_Remaining::change: - (JavaScript, client) ------------
 
if (xfa.event.newText == "Option1") {
	this.rawValue = 8;
} else {
	this.rawValue = 4;
}

Thanks

My Product Information:
LiveCycle Designer, Windows
rwherman
Registered: Feb 16 2009
Posts: 6
I figured this would happen right after I posted the message, but I figured it out. I've been putting it in the wrong field. Instead of putting it in the Budget script section, I've putting it in the NumberField Script section. Doh!
rwherman
Registered: Feb 16 2009
Posts: 6
So my corrected code would be as follows: (changes in bold)

----- Document.MainForm.[b]Budget_Type[/b]::change: - (JavaScript, client) ------------

if (xfa.event.newText == "Option1") {
[b]NumberField[/b].rawValue = 8;
} else {
[b]NumberField[/b].rawValue = 4;
}