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

Text Field Entry to Combo Box Index Change

Gattaca714
Registered: Dec 16 2009
Posts: 25
Answered

I've searched and searched, and I can only find radio button examples, so I'm hoping that this is a relatively easy fix.

Text Field Name: CityBooths
Combo Box Name: RentBooth
Options for RentBooth: Rent (Export Value = 1)
No (Export Value = 2)

If the value of Citybooths is less than 10 then RentBooth index should be 2 (No). If Citybooths is greater than 10 then Rentbooth index should be 1 (Rent)

Custom Calculation Script
If (Citybooths.editvalue < 10)
{
this.field.index = 2

If (Citybooths.editvalue >10)
this.field.index = 1
}

Any help would be appreciated. I am using Acro Forms. Acrobat 9 Pro.

My Product Information:
Acrobat Pro 9.2, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
How did you come up with this code? It's not valid at all.

For starters, you can't access a field using this.field. There's no such thing.
Also, a field object has no property called index, nor editValue.
Also, you're missing an opening bracket ({) at both of your if statements.

I suggest you go back to the reference files and have another look there.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Gattaca714
Registered: Dec 16 2009
Posts: 25
I got this code from a yahoo/answers reply to a similar question that was posed. That question was never answered correctly, so I posted it thinking that someone might could see what I was attempting to do, and help me with an accurate code.
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
There are significant difference between Mozilla JavaScript and Acrobat JavaScript implementations. Adobe uses the ECMA-262 compatibility with some modifications and additions.

Also if you find a Java language solution, this code is different since JavaScript is not the same as the Java language.

George Kaiser

try67
Expert
Registered: Oct 30 2008
Posts: 2398
That code is utter rubbish. Here's what you should use (in the custom calculation field of "RentBooth"):

citybooths = this.getField("Citybooths").value;if (citybooths < 10){event.value = 2;}else if (citybooths > 10) {event.value = 1;}

BTW, you might want to consider handling the case where citybooths is exactly 10.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Gattaca714
Registered: Dec 16 2009
Posts: 25
That did it!

I've spend hours on end trying to figure this out. Thank you so much.