Hi
Have come to a halt over a subform issue.
Rest of form is working fine and I have one subform with an add and delete button which works fine
Second subform, using same script, will add but not delete.
As it's too complex to explain and can't upload here any more form is avalable at:
Follow the doewnloads link to get the PDF
Thanks
Graham
Solved! Go to Solution.
Views
Replies
Total Likes
Place the following code in your "Delete Picture Place Holder" button's click event and comment out the existing code..
if (form1.OpportunitySubform.PicandTextSubform.PicSubform.instanceManager.count == 1) {
xfa.host.messageBox("The minimum allowable number of subforms is 1. You cannot remove any more subforms.", "Warning", 3);
}
else {
// This script uses the removeInstance() method to remove the last instance of the
// Subform2 object (represented by nNumSub) contained in Subform1.
form1.OpportunitySubform.PicandTextSubform.PicSubform.instanceManager.removeInstance(this.parent.index);
}
Similarly on the "Add Picture" Button's click event:
if (form1.OpportunitySubform.PicandTextSubform.PicSubform.instanceManager.count<5) {
// This script uses the addInstance() method to add a new instance of the
// Subform2 object contained in Subform1.
form1.OpportunitySubform.PicandTextSubform.PicSubform.instanceManager.addInstance(1);
}
else{
xfa.host.messageBox("The maximum allowable number of subforms is 5. You cannot add any more subforms.", "Warning", 3);
}
Thanks
Srini
Views
Replies
Total Likes
To be able to duplicate a subform, it needs to be a positioned subform wrapped in a flowed subform. The one that's not working is a flowed subform. It's not as simple as just wrapping the entire opportunity subform in a flowed subform and setting the opportunity subform to positioned, but that's where you'll need to start.
Regards,
djaknow
Views
Replies
Total Likes
Forms are duplicating fine.
When I try to use 'delete picture placeholder' button I get an error message
Same code works fine on 'delete Opportunity' button
Views
Replies
Total Likes
Now that's interesting. I didn't know you could duplicate a flowed subform. In any case, this script:
if (PicSubform.nodes.item(nCount).className == "subform") {
nNumSub = nNumSub + 1;}
is not incrementing the nNumSub variable. When I print the nNumSub value to a message box it returns -1 every time. Does that help?
Views
Replies
Total Likes
I'm thinking you'd be better off to just use the count method to track the number of PicSubform instances, as in:
var nNumSub = PicSubform.instanceManager.count;
if (nNumSub < 1){
<error message here>
}
Views
Replies
Total Likes
I found something else as well. This statement:
form1.PicSubform.instanceManager.removeInstance(nNumSub);
wasn't working to remove the extra subform instance. Since you're referencing the instanceManager from inside the subform, you don't need the form1 at the beginning of the statement. When I got rid of it and tracked the number of subforms with the count method, the form removes the instance correctly.
Views
Replies
Total Likes
Place the following code in your "Delete Picture Place Holder" button's click event and comment out the existing code..
if (form1.OpportunitySubform.PicandTextSubform.PicSubform.instanceManager.count == 1) {
xfa.host.messageBox("The minimum allowable number of subforms is 1. You cannot remove any more subforms.", "Warning", 3);
}
else {
// This script uses the removeInstance() method to remove the last instance of the
// Subform2 object (represented by nNumSub) contained in Subform1.
form1.OpportunitySubform.PicandTextSubform.PicSubform.instanceManager.removeInstance(this.parent.index);
}
Similarly on the "Add Picture" Button's click event:
if (form1.OpportunitySubform.PicandTextSubform.PicSubform.instanceManager.count<5) {
// This script uses the addInstance() method to add a new instance of the
// Subform2 object contained in Subform1.
form1.OpportunitySubform.PicandTextSubform.PicSubform.instanceManager.addInstance(1);
}
else{
xfa.host.messageBox("The maximum allowable number of subforms is 5. You cannot add any more subforms.", "Warning", 3);
}
Thanks
Srini
Views
Replies
Total Likes
Thanks Srini - superb
These forms are distributed with Acrobat Reader Rights to be saved individually.
If a flowed form goes over a page break and you return to edit that field it displays both the scrolling text box and the page box as well as buttons appearing under the text.
This makes it very difficult to see where you are in the document.
Do you know if this is just a Reader 'thing' or is there a way round it.
Thanks again
Graham
Views
Replies
Total Likes
I feel it is a Reader thing.. Because when you check the check box "Allow Page breaks with in Content", if the text inside a TextField overflows to next page, if you click inside the TextField, the Reader will place the scrollbars automatically.
Hope this helps..
Thanks
Srini
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies