Expand my Community achievements bar.

Auto-filling proceeding fields from user's initial input - Possible? How?

Avatar

Level 1

Hi there,

I'm quite new to LiveCycle (and scripting). That being said, I'm trying to create some automation in forms for work.

I've been asked to create a product order form in which the Order Administrator would choose the product from a list of Product Codes. Once s/he chooses the Product Code [numeric field] from this list, the Product Description [text field] appears right next to it, and then the Product Price [numeric field] would populate the last field. I will duplicate this over multiple rows into a table, then autosum the last column which should be filled with various product prices, taxes, S&H, etc. (autosumming the Price field is easy enough - this is not my issue so let's just focus on the major concern of auto-filling descriptions and prices for now...)

For e.g.

Product CodeDescriptionPrice
6759-85746-098 [Order Admin chooses from list]Large textbook (x1) [Automatically inputs based on Product Code]$30.00 [Auto-inputs from Product Code]
5864-98723-124   Black pens (x10/set)$5.25

I've tried for days to figure out how to script this, going through numerous forums, printing off reams of Adobe help documents, trying to learn Java and/or FormCalc in solitude, and yet I still can't figure this out. To explain, I'm not a coder/developer but a print-focused graphic designer.

If anyone knows how I can solve this I'd be very grateful. I'm now wondering if a) I need to somehow connect (bind?) the information in an external database or sheet (Excel?), b) figure out some elaborate script that would automate these descriptions and prices, and/or c) bang my head against the wall in fruitless frustration.

Thanks for any help anyone can offer.

7 Replies

Avatar

Level 6

A simple example.  May not meet your needs depending on the number of products.

Droplist named ProductCode

Text Fields named Description and Price

Java Script the droplist on the change event

if (xfa.event.newText=="5864-98723-124")

{Description.rawValue="Black Pens"

Price.rawValue="$5.25"

}

Avatar

Level 1

Thanks for this... however it's not working for me. Nothing is coming up after the initial choice (Product) is made when I make the form live.

I "dumbed down" the fields I mentioned in the first message. Here are the actual form field headings I'm working with:

Product (drop down list) - consists of ISBN numbers

Quantity (numeric field) - number of books to be ordered

UnitPrice (numeric field) - price per book

Amount (numeric field) - total cost of books ordered for that line/row

Now is there something I need to be concerned with regarding the values assigned (e.g. Calculated - Read Only versus User Entered - Optional)?

Again, please remember I've VERY new to scripts and LiveCycle.

And once again, thank you for any help offered.

Avatar

Level 1

Hi Paul,

The bits of the form I need to work on are located here (with detailed ideas on how we'd need it to work).

Thank you so much for your help thus far - greatly appreciated!

Avatar

Level 6

Without seeing the code, I can only offer suggestions.  Make sure your quotation and brackets are correct.

Maybe you can copy and paste the code in a reply

Avatar

Level 1

So far the only coding I have gotten close to is autosumming (easy enough) and auto-updating of the date.
The biggest issue is just getting the description and price from the ISBN first chosen. The rest I can (sort of - remember, I'm a newbie to web/java/formcalc) figure out as I go. I currently have no code for the ISBN --> Description, then Price auto-entry. Could you perhaps just throw me a couple of those suggestions you mentioned?

Avatar

Level 6

change your numeric fields to text fields