I need subforms to appear in the order they are called by the user.
These are the subforms:
xfa.form.SBtemplate.pagetypes.discussion
xfa.form.SBtemplate.pagetypes.dropbox
xfa.form.SBtemplate.pagetypes.assessment
xfa.form.SBtemplate.pagetypes.page
I have buttons that call each one. Here is the code from one button, meant to call the pagetypes subform, but only show the page subform inside it. This was suggested to me as a way to have the subforms stay in the order they are called.
SBtemplate.addpage.pagebtn::click - (JavaScript, client)
xfa.form.SBtemplate._pagetypes.addInstance(1);
xfa.form.SBtemplate.pagetypes.discussion.presence="hidden"
xfa.form.SBtemplate.pagetypes.dropbox.presence="hidden"
xfa.form.SBtemplate.pagetypes.assessment.presence="hidden";
However, only the discussion subform is hidden when I click this button. And only if it is listed first in the code. If I switch the lines of code, then nothing is hidden.
I need to find a way to call each subform when it's button is clicked and for the subforms to display in the order the user clicks the buttons (in other words: the subform called needs to appear just above the addpagebtns subform.
I have attached my form. To recreate this, click on Edit to existing course. You should be presented with buttons representing the various subform types.
Solved! Go to Solution.
Views
Replies
Total Likes
You have to add another Pages subdorm before adding the individual subform. I modified th esample to show you.
Paul
Views
Replies
Total Likes
You have done everything correctly;
The only mistake you have done is : you typed dropbox. The actual value must be dropBox (javascript and field names are case sensitive)
Just change this on all references. It will work.
Good Luck!
Nith
It's still not working. The subforms (page, discussion, assessment, and dropbox) are only showing up in that order, even though I am calling the entire subform each time. Also, the buttons only work to call one instance. I need the user to be able to call as many instances as they want and for them to show up in the order the user clicks the buttons. Does this have to do with subform instances? Do I need to reference the instance # somehow? Can I use choice subform sets for this? If so, how? If not, do you have any other ideas? I have attached an updated file.
Thank you so much for your help. This has been so frustrating and I really appreciate that there are people out there willing to help.
Views
Replies
Total Likes
You have to add another Pages subdorm before adding the individual subform. I modified th esample to show you.
Paul
Views
Replies
Total Likes
Thank you! You can't imagine how happy you've made me.
Views
Replies
Total Likes
Hi Paul, I have run into another problem with this form.
Your code worked great, but now I am having trouble making the buttons within each subform (page, discussion, dropbox, assessment) work right. For example, if I create a "page" suform, and then click the buttons to create instances of the image, audio, and video subforms, it works fine. Then I create another "page" subform and the buttons work fine there, too. But if I go back up to the previous "page" subform and click to create a new instance of image or audio, the new instance shows up in the most recent "page" subform I created instead of the one I am currently in.
How can I fix it so that the the adding and removing of subforms happens only in the subform the user is currently in, not in the most recent instance?
I have attached my form.
Steps to reproduce:
Click Edit to existing course.
Click Page (instance 1)
Click to add image, audio, video
Click Page (instance 2)
Go to Page (instance 1) and click image
The new image field appears in Page (instance 2)
Thanks!
Update: I figured this out. I used this code:
xfa.resolveNode("xfa.form.SBtemplate.Pages[" + (this.parent.parent.parent.index) + "]").page._image.addInstance(this.parent.index);
I don't know if that is the "right" way to do it, but it worked.
Views
Replies
Total Likes
Yes that is the right way ....
Paul
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies