Skip to main content
Participant
April 9, 2024
Question

Why isn't my java working?

  • April 9, 2024
  • 4 replies
  • 1875 views

Can anyone tell me why my js is not working?  I have the same data on two different .pdf.  I want to be able to have someone fill in the forms on a screen and press a button to open and populate the other .pdf with that information that is entered.  Nothing I seem to do is working.  I made sure all my fields were named the same.  Can anyone help?  Please.

 

This is the script.

 

this.slave=app.openDoc("IKO Proposal.pdf",this);
this.bringToFront();

for (var i=0; i<6; i++){
var FLIKOProposalformData = this.getField("FLIKOProposalform."+i);
var IKO_ProposalData = this.slave.getField("IKO_Proposal."+i);
IKO_ProposalData.value = FLIKOProposalformData.value;
}

slave.bringToFront();

    This topic has been closed for replies.

    4 replies

    try67
    Community Expert
    Community Expert
    April 9, 2024

    You need to save a reference to the current document using something other than the "this" object, as the new file you're opening will take over it once loaded. Also, I don't think the bringToFront method works any longer.

    Participant
    April 10, 2024

    Hi!  Thank you for the response... however... i have absoltuley no clue how to fix the "this" object... I was watching tutuorials online and that is what they had, I just adjusted it to my file names.  Same with the bringToFront method... I was just hoping someone could help me either rewrite or tell me where errors are.

    try67
    Community Expert
    Community Expert
    April 10, 2024

    Try this code:

     

    var primaryDoc = this;
    var secondaryDoc = app.openDoc("IKO Proposal.pdf", primaryDoc);
    
    for (var i=0; i<6; i++){
    	var FLIKOProposalformData = primaryDoc.getField("FLIKOProposalform."+i);
    	var IKO_ProposalData = secondaryDoc.getField("IKO_Proposal."+i);
    	IKO_ProposalData.value = FLIKOProposalformData.value;
    }
    
    Bernd Alheit
    Community Expert
    Community Expert
    April 9, 2024

    Check the Javascript console for errors.

    kglad
    Community Expert
    Community Expert
    April 9, 2024

    in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

    p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



    <"moved from using the community">
    kglad
    Community Expert
    Community Expert
    April 9, 2024

    java != javascript