• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Why isn't my java working?

New Here ,
Apr 09, 2024 Apr 09, 2024

Copy link to clipboard

Copied

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();

Views

248

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2024 Apr 09, 2024

Copy link to clipboard

Copied

java != javascript

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2024 Apr 09, 2024

Copy link to clipboard

Copied

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">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2024 Apr 09, 2024

Copy link to clipboard

Copied

Check the Javascript console for errors.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2024 Apr 09, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 10, 2024 Apr 10, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2024 Apr 10, 2024

Copy link to clipboard

Copied

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;
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 10, 2024 Apr 10, 2024

Copy link to clipboard

Copied

Hi!

Thank you!  unfortunately it still doesn't work, I can upload the docs if you'd like, b/c I have like 5 or 6 different ones that I will be trying to do like this.  When I type it in the FLIKOProposalForm and click on the "Generate Invoice" button that I have created to open the IKO Proposal form none of the information transfers, even with this code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2024 Apr 10, 2024

Copy link to clipboard

Copied

You need to check the JS Console. The openDoc method, for example, will not return an object if used from a button.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 11, 2024 Apr 11, 2024

Copy link to clipboard

Copied

this?

 

//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------
 
//<Document-Level>
//<ACRO_source>ADBE::FileAttachmentsCompatibility</ACRO_source>
//<ACRO_script>
/*********** belongs to: Document-Level:ADBE::FileAttachmentsCompatibility ***********/
var v = app.viewerVersion;
if (v < 7)
{
var n = 0;
if (this.dataObjects != null)
n = this.dataObjects.length;
if (v >= 5 && v < 6 && n > 0 && (app.viewerVariation == "Full" || app.viewerVariation == "Fill-In"))
{
if (this.external)
app.alert("This document has file attachments. To view the attachments, click the Save button to save a copy of the document, open the copy in Adobe Acrobat, and use the File > Document Properties > Embedded Data Objects menu.", 3, 0);
else
app.alert("This document has file attachments. Use the File > Document Properties > Embedded Data Objects menu to view the attachments.", 3, 0);
}
else if (v >= 6 && v < 7)
{
if (n == 0)
{
var np = this.numPages;
syncAnnotScan();
for (var p = 0; p < np && n == 0; ++p)
{
var annots = this.getAnnots(p);
if (annots != null)
{
for (var i = 0; i < annots.length; ++i)
{
if (annots[i].type == "FileAttachment")
{
n = 1;
break;
}
}
}
}
}
if (n > 0)
{
if (this.external)
app.alert("This document has file attachments. To view the attachments, click the black triangle at the top of the document window's vertical scrollbar and choose File Attachments.", 3, 0);
else
app.alert("This document has file attachments. Use the Document > File Attachments menu to view the attachments.", 3, 0);
}
}
}
//</ACRO_script>
//</Document-Level>
 
//<AcroForm>
//<ACRO_source>Generate Proposal:Annot1:MouseUp:Action1</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:Generate Proposal:Annot1:MouseUp:Action1 ***********/
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;
}
//</ACRO_script>
//</AcroForm>
 
 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 11, 2024 Apr 11, 2024

Copy link to clipboard

Copied

No. Press Ctrl+J to open the Console after you run the code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2024 Apr 17, 2024

Copy link to clipboard

Copied

jamieswflrealtor_0-1713355191698.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2024 Apr 17, 2024

Copy link to clipboard

Copied

LATEST

One or the field names you're trying to access doesn't exist.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines