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

How to change object/field type in LiveCycle Designer during runtime ?

tarekahf
Registered: May 1 2008
Posts: 91

I am using Adobe LiveCycle Designer 7.1 and I need help about dynamic creation of objects (text fields and drop-down lists) or chaging object type during runtime and binding them to the appropriate data source node in XML Data Source.

I found one article which might be realted to this requirement, but it does not give complete details:

http://avokahhh.wordpress.com/2008/06/19/best-practise-for-pre-populating-a-drop-down-with-data/

I have a project which uses a PDF Form for capturing the Laboratory Results of a Lab Test request. This form has a repeating subform of several fields, including Free Text Fields or Dynamic Drop-Down List Fields to capture Laboratory Results.

So, if the result value is selected from a predefined list of entries, the Field must be Drop-Down, and it must be bound to the list of valid values from XML Data Source, and only one of the selected values should be allowed.

And, if the type of the result is numeric, only numeric data should be allowed for data entry, and there could be validation for min and max values.

For example, the value for CBC Test can be: Normal, Boarder Line, and Abnormal.

Or, another test result could be: Positive or Negative.

In other cases, the result is just a number value, with Min/Max values, or a free text entry.

I can write an ASP.NET Program to Generate the XML to describe the type of field and what are the possible values, and inject this XML to a PDF using XDP Format and render the result to the Browser on the client side (response.write(...)).

But, I am not sure how to do the dynamic binding and change the field type between a Text Field and Drop-Down during/after rendering the form to the client.

The XML Data which describe the Result Field Types, and Valid Entries could look like the following:

CBC Test
DropDown

Normal
Boarder Line
Abnormal

Stool
Number

5
15

Urine Color
FreeText

....other data elements...

Please help me to implement this, or give me some hints.

Thank you so much in advance for your help.

Tarek.

My Product Information:
LiveCycle Designer, Windows
tarekahf
Registered: May 1 2008
Posts: 91
Just to let you know that I did a research for hiring a consultant to get support for all development work for Adobe LiveCycle and .NET. I got 3 offeres, and submitted a request to hire a consultant to the section head.

Also, I promis that when I find a solution, I will post complete details.

Your help is always appreciated.

Tarek.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Tarek, I'm sorry to say this, but you are providing too much information, and asking non-specific questions. Questions to this forum should be short and consise.

You seem to know a great deal about the technical details of what you are doing. So I am sure that you are able to understand very detailed technical answers. Please do us the curtisey of asking short, specific questions.

Ok, now modifying the field type between a drop down and a text field is not possible at runtime. This information has to be availible at the time the form is created. That is to say at the time the form is designed or if you have servers for dynamically creating the form, then at the time the form is generated.

Please restate your question in terms that are as simple as possible.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

tarekahf
Registered: May 1 2008
Posts: 91
thomp,

Apologies if my question was too complicated or not clear.

I will start again, and I will start by presenting the problem, not by asking the question. Because, probably in my question, I am assuming a solution !

Problem:
=======

I am designing a form to capture the Laboratory Results of the Medical Unit (Clinic) at my work.

The Lab Result Table looks like the following (this is arbitrary sample):

Lab Req ID Test ID Result
======== ===== ====
111 1 55.5
111 4 Normal
111 9 Boarder Line
111 7 Negative
111 3 65.4
111 5 Abnormal


The Results must be consistent as per the following rules:
- Correct numeric value between a range of Min and Max, or
- Correct spelling of a possible set of values.

During Data Entry, I must make sure that the entered Result Values are correct as per the rule I mentioned earlier. This is needed to be able to generate analytical reports against such data.

I was thinking to use Drop Down to Validate the result which is part of a list of possible values, but how can can allow Data Entry for the numeric values in this case ? And, it does not look nice to display 2 fields to capture one result !

Tarek.
tarekahf
Registered: May 1 2008
Posts: 91
Ok, let us skip this topic "dynamic creation of objects (text fields and drop-down lists) during runtime" for the time being.

I have the following new problem.

The form need to be localized and published with 3 different languages: English, Arabic, and French.

I nearly figured out how to do that using Dynamic Binding for object properties. Just to make sure, here is my approach:

1. Create one resource XML File for each language for all captions as follows:

Submit
Enter your name
.... etc...

...

2. Using LC Designer, create an XML Data Source to one Resource File as mentioned above, and bind all captions to the related data elements in the Data Source.

3. Before publishing the form LIVE, create 3 copies of the PDF form, one for each language, and use Acrobat to import the Resource XML File (using Import Form Data Menu Option) of the related resource language file in the related PDF File, and save the PDF file.

Please tell me if the approach above is correct ?

Note: I am using LiveCycle Designer 7.1.

I am now facing the following problems:

1. For Arabic Language, the direction of the complete PDF should be from Right to Left. In HTML, it is very easy to change this during runtime, but I could not find a way to do this in LiveCycle Form. Please help ? Also the same applies for each field, and the alignment should be Right instead of Left.

2. The Locale property of each object, or at least for Text Fields should be set to Arabic/Country Name, during runtime, this is to allow proper handling of mixed Arabic/Latin/Punctuation characters in the same field, otherwise, it will look very funny ! Please help me to control the Locale property and Allignment/Direction Property in javascript during runtime.

Thank you in advance.

Tarek.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
After your last post explaining how you want the form to work, it seems that your design requirment is:

When the user selects a Test ID, the input element in the "Result" column needs to change to accomodate the type of data result that the test generates.

The solution is actually quite simple. There are a limited number of tests so the TestID input should be a drop-down list with static entries. Place several elements into the "Results" column, one for each type of result needed by a test. Set them all to "hidden". When the user selects a test ID, un-hide the appropiate result element. Since several of the result elements are drop-downs, you could use a single drop down, and then modify the entries for each of the different tests. But there are no problems using a different drop-down for each test id, and this approach requires less coding.

As for validation of input, this is a different issue. For the drop downs no validation is necessary since the user can only select one of several pre-defined entries. For the numerical inputs you need to write a validation script.

You're last post about languages is a completly different issue and should be posted to a new thread.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

tarekahf
Registered: May 1 2008
Posts: 91
thomp,

For localization issue, I have created a new thread:

http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=16205

For the Lab Result Issue, thank you so much. I am sure your approach is correct, however, please allow me to clarify some points:

1. Each form will capture the Lab Result of a Lab Request which may have upto to 40 Test ID/Names and Results.

2. The Type of Result is either:
- Numeric with Min/Max Validation,
- Text with a Pre-defined set of possible values, and we have about 5 different sets of each (such as Positive/Negative or Normal/Abnormal ...etc).

3. When the form is rendered to the client, it will be pre-populated with the Test IDs, Names and Empty Results to be populated by the Lab Technician. Such results will be put on a subform as repeating elements.

Regards ...

Tarek.