Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Repeating Subform

raykohbard
Level 2
Level 2

Hi Everyone,

i have a normal text field and a Add Field button in my form. If someone enters information in the text field, how do i make it such that when they click the Add Field button, a new field is added (but with default the same information that was entered earlier), and they can choose to overwrite the information on the subsequent repeated filed?

Many thanks.

Ray

4 Replies
jasotastic81
Level 7
Level 7

Presuming that your subform and text field are called sfInfo and tfInfo, respectively, here's my solution to this problem:


btnAdd::click


sfInfo.instanceManager.addInstance();


xfa.resolveNode("sfInfo["+ (sfInfo.instanceManager.count-1) +"].tfInfo").rawValue = xfa.resolveNode("sfInfo["+ (sfInfo.instanceManager.count-2) +"].tfInfo").rawValue;


raykohbard
Level 2
Level 2

Hi jasotastic81,

thanks a lot for your reply. Sorry i am not good with programming skills, which part should i add this script?

Thanks!

jasotastic81
Level 7
Level 7

It should be in the click event for your button. Remember, you'll need to change the object names in the script to match what you've got in your form. Also, that first line "btnAdd::click" was just to let you know what event it should be in.

raykohbard
Level 2
Level 2

Hi jasotastic81

thanks for your advise, i am still testing out the above.

However i have some new questions on repeating subforms, i believe you are an expert in this field and i wonder if i reach you through your personal email address? I would like to send a form to ask you for some advise if you dont mind!

Ray