Expand my Community achievements bar.

SOLVED

List Box Question ~ Please Help?

Avatar

Level 2

Thank you in advance for your time and consideration.  You're time and effort is greatly appreciated.

I have created a dynamic form (i am self taught), so I really need some help.

In my form, there are 3 sections:

In Section 1 of the list is a replicating form and a field (Text) called 'Location Description'.  There may be many locations.  In section 3, there is a field (List Box).  I would like the entries in to the Text Box (Location Description) field to be shown as available choices in the List Box (Garage Location) field in Section 3.

In section 2 of the list is a replicating form and a field (Text) called 'Last'.  There may be many locations.  In section 3, there is a field (List Box) called 'Driver'.  I would like the entries in the Text Box Field (Last) to be shown as available choice in the List Box (Driver) field in Section 3.

Please accept my apologies for not being able to explain this more intelligently.

I thought there might be a way to attached the copy of my form?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Rob,

No problem!

Here are a series of screenshots for sharing a file on Acrobat.com. You don't need to share a workspace. Just click on the file to bring up the menu. Work through the share process and then at the end click "copy link" and then paste this into the forum post:

AcrobatCom01.png

AcrobatCom02.png

AcrobatCom03.png

AcrobatCom04.png

I will try and have a look at your form later.

Happy Easter!!

Niall

View solution in original post

13 Replies

Avatar

Level 10

Hi,

You need to loop through the repeating rows and look at the value of the textfield for each row. Then add this value to the listbox.

Here is a sample: https://acrobat.com/#d=byrO8kt0Sm6t*wyOS7sxGw

Look at the script in the exit event of the location description textfield.

Good luck,

Niall

Avatar

Level 2

Hi Niall,

Thank you!  I could actually incorporate this into one of my forms.

However, In similarity to your example, I would like to have these items listed as the 'choices' in a drop down list or as multiple choice selections in a drop down list box.

My form (i think this will work)

https://acrobat.com#w=BpbH2fG5cWy1AyrwXNLVwA

That said, the other is really cool and I thank you for your help.

Have you don't much developing in the past?


Best,


Rob

Avatar

Level 10

Hi Rob,

I can't seem to access your form from here. Did you publish/share it?

In any case, you can swap out the listbox for a dropdown. The process/script for clearItems() and addItem() is the same for a dropdown as it is for a listbox.

Listboxes will accept multiple choices (control+click), but dropdowns will only accept one choice.

I have been at this for a few years. Here are some resources that you might find helpful:

http://www.adobe.com/go/learn_lc_scriptingBasics

http://www.adobe.com/go/learn_lc_scriptingReference

http://www.adobe.com/go/learn_lc_formCalc

http://www.adobe.com/devnet/livecycle/articles/Adobe_XML_Form_Object_Model_Refer ence.pdf

http://www.adobe.com/devnet/acrobat/pdfs/lc_migrating_acrobat_xmlform.pdf

And a very handy resource (and while it is for version 6 it is still very good because of the way it is laid out):http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf

JP Terry's book on LC Forms is very good and we use www.pdfscripting.com (which is a subscription service).

The help file also helps with syntax and LC Designer comes with templates/examples.

Lastly, check out the Developer's Network on http://www.adobe.com/devnet/livecycle/

Good luck,

Niall

Avatar

Level 2

Hi Naill,

I feel bad that I'm wasting your time.  Thank you very much for you help.

I can't seem to figure out how to share a workspace with you (or anyone else) without their e-mail address.  I need to get this resolved and move on to the next part of the project, but I don't want you to feel compelled to reply.  Unfortunately, without being able to see my form, it is difficult to explain my question.

This is the URL for the Acrobat.Com shared workplace.  I suppose that inorder to share it with you I must send you an invitation by email.

https://acrobat.com#w=BpbH2fG5cWy1AyrwXNLVwA

Best Regards & Happy Easter!

Rob Schild

Avatar

Correct answer by
Level 10

Hi Rob,

No problem!

Here are a series of screenshots for sharing a file on Acrobat.com. You don't need to share a workspace. Just click on the file to bring up the menu. Work through the share process and then at the end click "copy link" and then paste this into the forum post:

AcrobatCom01.png

AcrobatCom02.png

AcrobatCom03.png

AcrobatCom04.png

I will try and have a look at your form later.

Happy Easter!!

Niall

Avatar

Level 10

Rob,

The amended form is here: https://acrobat.com/#d=OmAaVpYKOUH7cBtmEObTeQ

If you look at the exit events of the garage location and last name fields, you will see the script that loops through each instance of the repeating subform and adds the value to the dropdowns.

It was slightly complicated that the dropdowns are also in a repeating subform, so there is an additional loop.

Also I have added a loop to the add button for the last repeating subform, to add the items to the new dropdowns.

Hope this helps,

Niall

Avatar

Level 2

Hi Niall,

Thank you.

As long as they enter each section in order, the user should be ok.  But if the user goes back to enter another driver or location, the drop down lists become populated again and choices duplicated.

Nevertheless, I thank you very much for your time and assistance.

Best Regards,


Rob Schild

Avatar

Level 10

Hi Rob,

You're very welcome.

You will know how users fill in the form and how best to adapt the script to suit.

The choices should not be duplicated because of the clearItems() script. You could add in a line after the clearItems() to null the dropdowns:

dropdownReference.rawValue = null;

This will clear previous choices (restored the dropdowns to null). However this can be annoying for the user, as they need to reselect the choices again.

Have a good weekend,

Niall

ahhh...

I see what you mean now. I must have a count wrong in one of the loops. I will check tomorrow and post a correction. Test, test, TEST!!!!

Avatar

Level 2

Thank you again... Ok... I owe you a drink...  Thank you.

I would be dangerous if I could just figure this out.

Can you tell me if something we changed to make this work is affecting how the pages display when each of the instances appear.  It seems that the instances run off the form???

And I thouht with would be simple...

Avatar

Level 10

Hi Rob,

I just had to enclose the clearItems in a for loop to go through all of the instances of the last subform. It is working ok now.

I have adjusted the items on the Master Page, so that they are outside of the page contents.

Lastly your form was 1Mb in size. This was mainly due to the inclusion of different fonts. Replacing Arial with Myriad Pro reduced the file to 610Kb. There is also an option in the File > Form Properties > Save Options to not embed fonts. Because Myriad Pro is a common font, it is worth testing if the form performs OK in your environment without embed this font. Doing this will reduce the file down to 25Kb.

Parallels Desktop1.png

Here is your form: https://acrobat.com/#d=2szVkcMWkcTt2pQln*xRew

Good luck,

Niall

Avatar

Level 2

Thank you Niall,

I'll take a look at this in a moment; First of all; Happy Easter to you and yours.

So the font's are causing the pages to run off the page as the intstances expand?  I did't even think to look at the fonts.  You don't know how many times that I went back and looked at the pagination.

Thank you again and have a Great Weekend!!!!  You're the best!

Let me know if you ever would like to speak about a larger project.

https://acrobat.com/#d=FHqGqtVuZwQaJYvq-SMOrQ

Ok.. I went back and looked and the fields a populating great!  Thank you.  But the pages are still running out of room?  Is that because of the fonts?

Avatar

Level 10

Hi Rob,

Just back from a windy walk; easter egg hunt done - so kids are happy. Happy Easter to you and yours as well!!

The fonts weren't the issue with the page layout - this only affected the file size.

I have looked at the pagination issues and here is the form: https://acrobat.com/#d=O3Gz5ON-lH2nrsPAH0EQ-g

There were some issues with the form layout and pagination, which I have corrected.

First, I would recommend setting up a page (page1) to flowed and then having content in subforms within the page.

Form01.png

Then in page1 and all other flowed subforms it is important to allow content to break across pages:

Form02.png

When dealing with pagination, set the first subform to the content area on the master page. Do not tick "keep with previous":

Form03.png

All other subforms are then paginated to "follow previous":

Form04.png

The script for the reset button is: xfa.host.resetData();

But this will not remove instances of the repeating subforms. To do this you would need to loop through and use removeInstance();

Lastly you should consider using the caption for textfields and numericfields. It makes it easier laying out the form and is quicker to render as there is one object to layout instead of two. Also you still have control over the font and paragraph of the caption and value separately.

It seems to be working OK now. Let me know if you have any other problems with it.

Good luck,

Niall