Expand my Community achievements bar.

Form with contingent number of subforms

Avatar

Level 2
I'm trying to create a proposal submission form. Most proposals are submitted by just one person, many by two or three, but in rare cases by as many as twelve. I am therefore trying to insert a subform for the personal data that should appear on the form as many times as needed.



I tried to insert a buttons to trigger additional subforms to appear but this doesn't seem to work. Now I'm totally lost to as to solve this issue.
5 Replies

Avatar

Level 4
Hi



First thing to check, do any other buttons work in the PDF? I say this as you need to ensure that it is saved as a dynamic PDF. Sometimes I open a new form with email and print buttons and this kick starts the process, and you can delete them if needed.



If this is working then you will need to check that you have ensured that both the page that the subform is on is set to flow and also that the subform is set to flow as well.



Finally check that your code is correct for the button(info on this in Adobe help) to trigger and it should be entered as a click event.



This should get it going. Hope this helps

Avatar

Level 2
Thank you very much, Darren!



I've succeeded in formatting the form as a dynamic PDF allowed the subform to flow.



The problem seems to be with how to program the button so that it would trigger the add subform event(s). I can't find anything on this in the Adobe help function.



Would you, or anybody in the forum know how to solve this?

Avatar

Level 4
This is some javascript that should work. In this exampple it will keep adding your subform upto six times. Enter it into the click event and remember to substitute the names I have put in and get spelling correct.



"Pagename.Subformname".occur.max = "6";

"Pagename.Subformname".occur.min = "1";

"Pagename.Subformname".occur.initial = "1";



if ("subformname".instanceManager.count == "subformname".instanceManager.max)

{

xfa.host.messageBox("You have entered the maximum number of subforms", 1);

}

else

{

Subformname.instanceManager.addInstance(1);

xfa.form.recalculate(1);

}



I hope this helps

Avatar

Level 2
Thanks very much, Darren. It's an amazing Javascript. I've added it in right away. However, I'm now trying since hours but the repeat subforms are still not showing up in the PDF. Does it perhaps have something to do with the settings for binding? Would you, or anybody in the forum know how to resolve this? <br /><br />PS: FYI, this is the script:<br /><?xml version="1.0" encoding="UTF-8"?><br /><?xfa generator="AdobeLiveCycleDesignerES_V8.2.1.3144.1.471865" APIVersion="2.8.8118.0"?><br /><xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2009-03-10T15:52:45Z"><br /><template xmlns="http://www.xfa.org/schema/xfa-template/2.6/"><br /> <?formServer defaultPDFRenderFormat acrobat8.1dynamic?><br /> <?formServer allowRenderCaching 0?><br /> <?formServer formModel both?><br /> <subform name="form1" layout="tb" locale="en_US"><br /> <pageSet><br /> <pageArea name="Page1" id="Page1"><br /> <contentArea x="0.25in" y="0.25in" w="8in" h="10.5in"/><br /> <medium stock="letter" short="8.5in" long="11in"/><br /> <?templateDesigner expand 1?></pageArea><br /> <?templateDesigner expand 1?></pageSet><br /> <subform w="8in" h="10.5in" name="Page1"><br /> <subform name="Subform1" x="3.175mm" y="6.35mm" w="87.884mm" layout="lr-tb"><br /> <border><br /> <edge stroke="dotted" presence="hidden"/><br /> <corner stroke="dotted" thickness="0.175mm" presence="hidden"/><br /> </border><br /> <keep intact="contentArea"/><br /> <field h="8.89mm" name="LastName" w="81.28mm"><br /> <ui><br /> <textEdit hScrollPolicy="off"><br /> <border><br /> <?templateDesigner StyleID aped3?><br /> <edge stroke="lowered"/><br /> <?templateDesigner StyleID aped3?></border><br /> <margin/><br /> </textEdit><br /> </ui><br /> <font typeface="Myriad Pro"/><br /> <margin bottomInset="0.9906mm" leftInset="0.9906mm" rightInset="0.9906mm" topInset="0.9906mm"/><br /> <para marginLeft="0pt" vAlign="middle"/><br /> <caption reserve="24.4622mm"><br /> <font typeface="Myriad Pro"/><br /> <para marginLeft="0pt" marginRight="0pt" textIndent="0pt" vAlign="middle"/><br /> <value><br /> <text>Given Name</text><br /> </value><br /> </caption><br /> <border><br /> <edge presence="hidden"/><br /> <edge presence="hidden"/><br /> <edge presence="hidden" thickness="0.0762mm"/><br /> <edge presence="hidden"/><br /> <corner presence="hidden" thickness="0.0762mm"/><br /> </border><br /> <validate nullTest="error"><br /> <message><br /> <text name="nullTest">Required field: Please write in your first or given name. </text><br /> </message><br /> </validate><br /> <value><br /> <text maxChars="40"/><br /> </value><br /> </field><br /> <field h="8.89mm" name="FirstName" w="81.28mm" y="8.89mm"><br /> <ui><br /> <textEdit><br /> <border><br /> <edge stroke="lowered"/><br /> </border><br /> <margin/><br /> </textEdit><br /> </ui><br /> <font typeface="Myriad Pro"/><br /> <margin bottomInset="0.9906mm" leftInset="0.9906mm" rightInset="0.9906mm" topInset="0.9906mm"/><br /> <para marginLeft="0pt" vAlign="middle"/><br /> <caption reserve="24.2222mm"><br /> <font typeface="Myriad Pro"/><br /> <para marginLeft="0pt" marginRight="0pt" textIndent="0pt" vAlign="middle"/><br /> <value><br /> <text>Family Name</text><br /> </value><br /> </caption><br /> <border><br /> <edge presence="hidden"/><br /> <edge presence="hidden"/><br /> <edge presence="hidden" thickness="0.0762mm"/><br /> <edge presence="hidden"/><br /> <corner presence="hidden" thickness="0.0762mm"/><br /> </border><br /> <validate nullTest="error"><br /> <message><br /> <text name="nullTest">Required field: Please write in your family name/last name.</text><br /> </message><br /> </validate><br /> <value><br /> <text maxChars="35"/><br /> </value><br /> </field><br /> <field h="8.89mm" name="Email" w="81.28mm" y="17.78mm"><br /> <ui><br /> <textEdit><br /> <border><br /> <edge stroke="lowered"/><br /> </border><br /> <margin/><br /> </textEdit><br /> </ui><br /> <font typeface="Myriad Pro"/><br /> <margin bottomInset="0.9906mm" leftInset="0.9906mm" rightInset="0.9906mm" topInset="0.9906mm"/><br /> <para marginLeft="0pt" vAlign="middle"/><br /> <caption reserve="8.9333mm"><br /> <font typeface="Myriad Pro"/><br /> <value><br /> <text>Email</text><br /> </value><br /> <para vAlign="middle"/><br /> </caption><br /> <value><br /> <text maxChars="100"/><br /> </value><br /> </field><br /> <field name="Affiliation" w="81.28mm" h="8.89mm" y="26.67mm"><br /> <ui><br /> <textEdit><br /> <border><br /> <?templateDesigner StyleID aped3?><br /> <?templateDesigner StyleID aped3?><br /> <edge stroke="lowered"/><br /> </border><br /> <margin/><br /> </textEdit><br /> </ui><br /> <font typeface="Myriad Pro"/><br /> <margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><br /> <para vAlign="middle"/><br /> <caption reserve="31.0489mm"><br /> <font typeface="Myriad Pro"/><br /> <para vAlign="middle"/><br /> <value><br /> <text>Affiliation/Institution</text><br /> </value><br /> </caption><br /> <value><br /> <text maxChars="40"/><br /> </value><br /> </field><br /> <field h="8.89mm" name="Address" w="81.28mm" y="35.56mm"><br /> <ui><br /> <textEdit><br /> <border><br /> <edge stroke="lowered"/><br /> </border><br /> <margin/><br /> </textEdit><br /> </ui><br /> <font typeface="Myriad Pro"/><br /> <margin bottomInset="0.9906mm" leftInset="0.9906mm" rightInset="0.9906mm" topInset="0.9906mm"/><br /> <para marginLeft="0pt" vAlign="middle"/><br /> <caption reserve="16.51mm"><br /> <font typeface="Myriad Pro"/><br /> <value><br /> <text>Address</text><br /> </value><br /> <para vAlign="middle"/><br /> </caption><br /> <value><br /> <text maxChars="255"/><br /> </value><br /> </field><br /> <field h="8.89mm" name="City" w="81.28mm" y="44.45mm"><br /> <ui><br /> <textEdit><br /> <border><br /> <edge stroke="lowered"/><br /> </border><br /> <margin/><br /> </textEdit><br /> </ui><br /> <font typeface="Myriad Pro"/><br /> <margin bottomInset="0.9906mm" leftInset="0.9906mm" rightInset="0.9906mm" topInset="0.9906mm"/><br /> <para marginLeft="0pt" vAlign="middle"/>

Avatar

Level 4
Hi



Send me the form at djl64@st-andrews.ac.uk. I am no expert but I will have a look for you and see if I can spot anything.