Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Auto-populate form fields based on end user input?

Avatar

Level 3

I'm currently attempting to create a new form that has a combo box "Locations" with various options.  What I'm looking to do is have another text field auto populate other fields related to that location (such as address, contact information) to save on time and reduce opportunity for end user errors in input.

What are my options for accomplishing such a task?  Some form of binding fields with a MS database possibly?

Thanks in advance for any advice and assistance on this matter!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I created a sample for you .....have a look and let me know if this does the trick for you.

Paul

View solution in original post

12 Replies

Avatar

Level 3

To be more specific, is it possible to autofill fields B & C based on the end users entry in combo box field A.

A= Location

B=Address

C=Phone Number

I'm thinking that if I create a data source and bind it to my fields, I can then tie the fields in together so that once a selection is made for the location (A), fields B and C will be filled out automatically without further input from the user.

Am I'm way off base here, or is there a better solution to what I'm attempting to accomplish?

Any help is greatly appreciated.


Thanks.

Avatar

Former Community Member

You can accomplish what you want through scripting. How many different "locations" woudl there be? You can bind to a data source for this but the level of complexity increases as well if you are using Reader then you woudl need to Reader Extend the form to allow this (Reader does not allow connections to DBs by default).

Paul

Avatar

Level 3

I'm using LC Designer 8.


There would be 10-20 locations.

Suggestions?

Thanks in advance!

Avatar

Former Community Member

The easiest way is to code the 10-20 locations into the form usinng a switch statement in javascript (like a case statement in other languages). This is the simplest to implement but if you need to change one of the locations or add a new one then you must change the form.

The access to the DB is by far the right way to do it (as all of the information is kept centrally) but it will be an additional expense for Reader Extensions server as well as having the headache of maintaining the DSN connection on each machine that accesses to DB (note that this solution will only work on Windows).

If budget is an issue then hard coding the values is the most cost effective way and it will work on all platforms that support forms.

Paul

Avatar

Level 3

Paul,

The form and (potential) database would be located on a shared drive on the company network in which those that would use the form already have access to.

The pc's that user's would be using have Reader 9.

The pc I'm using for developing this form has LC Designer 8, Acrobat Professional 8, and Reader 9.

Ideally, I would "like" for the end user to have the ability to add new locations, addresses, etc ... in the event it is needed, although this would not be likely to come up.

Based on the software I have on hand, and the need to not incur additional expenses, what would you suggest?

Thanks again Paul!

Avatar

Former Community Member

You cannot access the database without incurring additional expense. Either you get Reader Extensions to allow Reader to acces the DB or you buy a copy of Acrobat for everyone who needs to access the DB.

The only other option (that I can think of) is to hardcode the values into the form.

Paul

Avatar

Level 3

I see.

Can you provide a basic rundown regarding switching statements and how they could be used to accomplish this task for pre-selected locations?

You're always of great help Paul.

Thanks.

Avatar

Correct answer by
Former Community Member

I created a sample for you .....have a look and let me know if this does the trick for you.

Paul

Avatar

Level 3

Absolutely that will work.

While ideally, using a DB would probably work better, this scripting solution will fulfill our current needs.

I sincerely appreciate the time spent in helping work this out.

Avatar

Level 2

Thank you so much for posting your example pguerett.

I found it to be extremely helpful.

Avatar

Level 1

Yes! Thanks Paul!! Very helpful for my dilemma as well!

Avatar

Level 1

This is exactly what I'm looking to do, but I can't seem to pull up the properties to take a peek at the script you used.  I'm just learning how to use AAX, and I'm not very experinced with scripting syntax.

The form I wish to do this same thing on (as in your attached sample) was an existing document I am turning into a fillable form in AAX.  YOur expertise would be greatly appreicated!  Thanks in advance

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----