I have a repeating subform with text fields for City, State and Zip. I want to take whatever the user enters in the first (or only) instance those fields and automatically put that information into a City, State or Zip field in a completely different section of the form. I just need to copy over the first instance of these fields if there are multiple instances. I can get this to work if the user adds an instance of the repeating subform and adds a second City, State and/or Zip but I cannot get it to work if there is only one instance of the repeating subform. It also does not work if the user adds an instance but does not fill in the City, State and/or Zip. I need it to work regardless of the number of instances.
As an example, here is what I put in the "change" event of the City field (inside the repeating subform) and it works if there is another instance added:
form1.Page3.CityOther.rawValue = form1.Page1.SubformRepeat[0].City[0].rawValue
(This is using FormCalc. I couldn't get JS to work.)
Solved! Go to Solution.
Views
Replies
Total Likes
I would put in the layout:ready event of form1.Page3.CityOther (in formcalc):
if (form1.Page1.SubformRepeat[0].City[0].isNull == 0) then
$ = form1.Page1.SubformRepeat[0].City[0]
endif
That way it has nothing to do with the instance manager and will just make one equal the other if there is a value in the first one.
Views
Replies
Total Likes
Something like this should work (JavaScript)
var cityCounter = form1.Page3.CityOther.instanceManager.count;
for (var i=0; i<cityCounter; i++)
{
xfa.resolveNode("form1.Page3.CityOther["+i+"]").rawValue = form1.Page1.SubformRepeat.City.rawValue;
}
Message was edited by: Sooperman23, because of terrible formatting.
Views
Replies
Total Likes
What's the best event to use? Also, what is the following line of code doing?
var cityCounter = form1.Page3.CityOther.instanceManager.count;
Page 3 has no repeating subforms. Only Page 1 has a repeating subform.
Thanks for your help!
Views
Replies
Total Likes
Ah, I misunderstood the question. If you could upload the pdf I could take a look.
Views
Replies
Total Likes
I don't see a way to upload the PDF. What's the process?
Views
Replies
Total Likes
I would put in the layout:ready event of form1.Page3.CityOther (in formcalc):
if (form1.Page1.SubformRepeat[0].City[0].isNull == 0) then
$ = form1.Page1.SubformRepeat[0].City[0]
endif
That way it has nothing to do with the instance manager and will just make one equal the other if there is a value in the first one.
Views
Replies
Total Likes
Genius. I keep avoiding FormCalc but this is the second time it's saved the day for me. Thank you so much for your help!!!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies