Expand my Community achievements bar.

can subforms move?

Avatar

Former Community Member
I have a two page form with three subforms whose presence is controlled by checkboxes. The user may select one or a combination of the subforms. If, for example, subform 2 & 3 are selected, I would like them to appear at the top of the page instead of in positions on the lower part of the page.
4 Replies

Avatar

Former Community Member
You have to use the move instance command.



so



subform.instanceManager.moveInstance(x,y);



where x is the subform you are moving and y is where you want it.



so if you have



subform.instanceManger.moveInstance(2,0); that would move ur 3rd instance, to the first position...as its 0 based.



my x and ys might be backwards but just test it out

Avatar

Former Community Member
How did you set it up so the subforms appear based on the checkboxes? I have been trying to get mine to work all day and I am running out of ideas.



Erin

Avatar

Former Community Member
For the checkbox click event, have



if(this.rawValue == "1")

{this.presence = "hidden"} //you want to subform to disappear when the checkbox has a value of 1

else{ this.presence = "visible"} // and appear if the checkbox has a value of zero.



Do this for each of the checkboxes.



The outmost subform has to be flowed, top to bottom, and the form must be saved as a dynamic form.

Avatar

Former Community Member
Paul, I don't think you should have to move your subforms at all - if they're in a flowed container, then the ones that you want should show up at the top, and the ones you don't want shouldn't show up. You need to use the correct Presence setting (Hidden) to make sure that the hidden subforms don't take up space on the page. (if they're "invisible" they still take up space in the layout).



Hope that helps,

Mike