Expand my Community achievements bar.

How do I get form to automatically copy/paste a group of text fields?

Avatar

Level 1

I have a group of text fields that are in my form. 

I would like the user to be able to select a number in a number field and it automatically paste “x” number of the group of text fields for the user.

I.E   The user states that he has 5 problems.  He goes to the numerical field and chooses the # 5.  I would like my form to automatically paste 5 of my text field groups for him to enter his data.

If this is not achievable then I would like to have a check box below my group of text fields asking “Is there another problem”.  When the user checks the box it automatically pastes another group of text fields for him to enter in his data.

4 Replies

Avatar

Level 7

Either of those options sounds doable. Would you be opposed to putting them in a table on a dynamic form? The customer enters the number of pieces, then you add "x" instances of a subform (or rows of a table if that's easier).each instance has an index from 0 to 1 less than the max. So, whatever you're doing with that number later,remember to calculate properly.

Here's an idea that I used at work. Instead of making the user decide beforehand how many boxes she needs, upon exiting the last column of the row or the last box in a subform, check to see if it was used. If it was, add another row/subform when the exit event occurs and set focus back to the first entry in the row/subform.

Avatar

Level 1

Both of these sound okay.

Alas, I will be the first to admit that I am not the best at the LiveCycle program.  Would you mind running me thru on how to go about doing these?

Steven

Avatar

Level 7

Here's an adapted version of a previous post. This example is using a button to just add however many the user needs one at a time.

Here's the steps for making a subform repeatable (which you'll have to do).

To create a repeating subform

  1. In the Hierarchy palette, select the parent subform of the subform you want to repeat. (See About subforms).
  2. In the Object palette, click the Subform tab, and in the Content list, select Flowed.
  3. Select the subform to repeat.
  4. In the Object palette, click the Subform tab and, in the Content list, select either Positioned or Flowed.
  5. Click the Binding tab and select Repeat Subform For Each Data Item.
  6. To specify the minimum number of repetitions, select Min Count and type a number in the associated box. If this option is set to 0 and no data is provided for the objects in the subform at data-merge time, the subform is not placed when the form is rendered.
  7. To specify the maximum number of subform repetitions, select Max and type a number in the associated box. If you do not specify a value in the Max box, the number of subform repetitions will be unlimited.
  8. To specify a set number of subform repetitions, regardless of the quantity of data, select Initial Count and type a number in the associated box. If you select this option and either no data is available or fewer data entries exist than the specified Initial Count value, empty instances of the subform are still placed on the form.

You can use the action builder to generate the new subforms for you, to save coding work.

Here's an example of a form's design view with the action builder open for you to see. I used a job application as my example.repeatingSubformExample.png

Avatar

Level 6

stvmjones- i know this is old, but have you found a solution to what you needed?  If not, you can use "setInstance" to achieve what you're looking for:

Place the following script on Exit event of the field that will carry the number of subform instances you desire to create (note, you will have to update the paths to match your form layout):

xfa.layout.relayout();

//Retrive instance count number

var vCount = Page1.TextField.rawValue;

//Set subform instance count per number indicated

Page1.Subform._Group.setInstances(vCount);

In this example, you would start with a Min and Initial count of 1 following jasotastic81 instructions (items 5 and 6).

Hope this helps you or someone else!