Copy link to clipboard
Copied
Hello, please see attached pdf file. What I am trying to do is be able to "copy and paste" page 2 of 2 to include the paragraph AND text fields entered by the user in page 1 (page 2 makes it read only). I plan to copy and paste it into an email which will then be sent out - unless the copy and paste feature can be cut out all together and simply have the entire text in page 2 be emailed. Hope this makes sense? and thank you all for your help!
Moved from Using the Community (which is about the forums) to a better forum... Mod
To find a forum for your program please start at https://community.adobe.com/
The text on that page is not even real text. It's just an image.
You will need to hard code all of it into your script. Something like this:
var msgBody = "Good morning " + this.getField("name3").valueAsString + ",\n\nThis is a paragraph...";
this.mailDoc({cTo: "ezloves2smile@server.com", cMsg: msgBody})
++Edited link I made a mistake in the PDF, is corrected now
Here's the original file with the email field and button added with that script above:
https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:38b70663-a8c0-4f70-a688-f2529154c822
If that is the case, then most likely yuo want to create multi-line textfield and make it read-only.
And use the same script modified slightly as a custom calculation script in the multi-line textfield like this:
event.value = "Good morning " + this.getField("name3").valueAsString + ",\n\nThis is a paragraph that will continue. Add date here " + this.getField("date3").valueAsString +" and as it continues it will go on, enter identifying number of individual here "+ this.getField("identity3")
...
Copy link to clipboard
Copied
The text on that page is not even real text. It's just an image.
You will need to hard code all of it into your script. Something like this:
var msgBody = "Good morning " + this.getField("name3").valueAsString + ",\n\nThis is a paragraph...";
this.mailDoc({cTo: "ezloves2smile@server.com", cMsg: msgBody})
Copy link to clipboard
Copied
Hi Try67, thank you for the prompt reply... this might sound incredibly dumb and please excuse my massive ignorance!!!
So in your code... where it says "Good morning + (textbox id imagine?) and then after the ,\n\nThis is a pragraph - the bolded this is a paragraph would continue to be the rest of the message? what about in between fields? - will it add them the same? and I cant thank you enough! What you're saying makes perfect sense but I want to make sure i dont mess up anymore
Copy link to clipboard
Copied
Awesome!
Thanks again Try67.
What would life be without a Try67... LOL!
Copy link to clipboard
Copied
Hello Try67, all I can say is WOW!!! - I'm a semi tech saavy person but next to you I feel like a caveman scratching my head! Very impressive work! I used your code, added the paragraphs and then added the "+" sign to add the additional fields I needed. Thank you! Truly! I know @ls_rbls was working hard on this too and I sincerely and whole heartedly appreciate the two of you!!! Both of you are truly amazing and kind-hearted individuals!!!
Copy link to clipboard
Copied
1 more thing Try67... and sorry to keep bugging. Is there a way to have the email load as a draft? It asks for my email but 3-5 of us may use the form and each one will email from their own. I didnt want to do a form and in the background change their emails and basically give them each 1 individual form? hope that makes sense?
Copy link to clipboard
Copied
Or if there is a way I can add the textfield with your code as a "readonly" and just copy and paste it so I can then add it to an email. Or any other user can copy / paste and add it to their email draft. Hope that makes sense?
Copy link to clipboard
Copied
I believe that is why I posted the prior example code using the "app.mailMsg" instead of "this.mailDoc".
"this.mailDoc" will attach the PDF in that email message, while "app.mailMsg" will just generate the email message based on the script that is executed in that PDF; it will launch your default email client automatically (usually MS Outlook--if set as default in Windows), and the message body of the wmail will be automatically populated with the data when the mail program loads.
Copy link to clipboard
Copied
That seems ideal
So how would the code look?
var msgBody = "Good morning " + this.getField("name3").valueAsString + ",\n\nThis is a paragraph...";
app.mailMsg ?
Im not sure and both answers would be correct because technically I could use the email version as Try67 offered and being able to just copy and paste the field also helps! Could i provide a correct answer to both if your code works too?
Copy link to clipboard
Copied
Is basically the same script, but I will send you the working button example in the form that you shared.
This was answered before in the forums for another user that we helped with the email part.
Just give me a few minutes and I will post the form back to you.
All you need to do is add a blank text field so that the users that are filling the form can fill out their email address in that field.
And when the button is clicked it will take the email adress string value and add it to the "cTo: this.getField("myEmailField").valueAsString;" instead of hardcoding it as "cTo: "ezloves2smile@server.com" in that script.
Copy link to clipboard
Copied
Be aware that app.mailMsg doesn't work in Reader, though, only in Acrobat...
Copy link to clipboard
Copied
Can app.mailMsg be used as an app.trustedFunction?
Copy link to clipboard
Copied
Sorry , What I meant is that it cannot be used in a privileged context?
Copy link to clipboard
Copied
In Reader? No.
Copy link to clipboard
Copied
Does this mean it won't work?
Copy link to clipboard
Copied
But in Acrobat?
Copy link to clipboard
Copied
So I have the script ready, but is there away to not make the document be attached to the email? Something like setting a "false" parameter to the document attachment part?
Otherwise this script for the button works (shown below) but the users will have to delete the attachment everytime in order to just send the email draft:
var msgSubject = "This is a test";
var msgBody = "Good morning " + this.getField("name3").valueAsString + ",\n\nThis is a paragraph that will continue. Add date here " + this.getField("date").valueAsString +" and as it continues it will go on, enter identifying number of individual here "+ this.getField("date3").valueAsString+" and finally enter the time here "+ this.getField("time3").valueAsString+" .";
this.mailDoc({ cSubject: msgSubject, cTo: this.getField("EmailAddress").valueAsString, cMsg: msgBody})
Copy link to clipboard
Copied
++Edited link I made a mistake in the PDF, is corrected now
Here's the original file with the email field and button added with that script above:
https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:38b70663-a8c0-4f70-a688-f2529154c822
Copy link to clipboard
Copied
This the corrected script it was a minor thing:
var msgSubject = "This is a test";
var msgBody = "Good morning " + this.getField("name3").valueAsString + ",\n\nThis is a paragraph that will continue. Add date here " + this.getField("date").valueAsString +" and as it continues it will go on, enter identifying number of individual here "+ this.getField("identity3").valueAsString+" and finally enter the time here "+ this.getField("time3").valueAsString+" .";
this.mailDoc({ cSubject: msgSubject, cTo: this.getField("EmailAddress").valueAsString, cMsg: msgBody})
Copy link to clipboard
Copied
Thank you @ls_rbls, its better than before but I get what you and Try67 are saying... its not allowing it. I just wanted it to pull up a draft to that it can be copied and then emailed by the user. As it stands now, it continues to try to force me to open and enter my info on outlook or other email. Please see attached image. Try67's answer auto did it without pushing a button and while that's great! here's the problem Im running into: let's say I have 3 other users that are using the form as an administrator and they need to enter info and send out their draft through their email. I would need access to their email AND password in order to give them their own custom form. That's why I was pushing so hard to just get the "copy and paste" feature. Another alternative was I was going to have them "print to file" as a pdf version for page 2 and just send an attachment but it seems like a lot more work, specially when someone is not at all tech saavy. I hope this makes sense? thank you both for your hard work, dedication and effort on this issue!
Copy link to clipboard
Copied
> But in Acrobat?
Yes, in Acrobat mailMsg will work.
The only way to do something like that in Reader is to use the launchURL method with a "mailto:" URL, but that has other issues, such as a limited length and no ability to include line-breaks...
Are you doing all of this just so the user can copy the text? If so, there are much easier ways, such as using a separate text field, or a dialog object.
Copy link to clipboard
Copied
Yes - its just to copy the important paragraphs.
Like lets say:
Hello (textbox 1), today is (date textbox) we will do this tomorrow at (time box) yada yada yada yada...
So i need it to copy the whole bolded area to include input texts. If they can copy and paste it, they can just open a draft in their email (be in gmail, outlook or whatever email theyre using) and they basically do their own draft email. Hope that makes sense?
Copy link to clipboard
Copied
But is your final goal to get it into an email, or are you just using that as a place from where it can be copied?
Copy link to clipboard
Copied
It can be either or. It will likely be copied to be drafted into an email (either user can access the form) but write their own info and email it from their own email. It can also just be kept to be copied and pasted into a separate document (let's say for record keeping purposes). The end goal is to be able to copy that entire text to include the textboxes from the info drawn - hope that makes sense?
Copy link to clipboard
Copied
If that is the case, then most likely yuo want to create multi-line textfield and make it read-only.
And use the same script modified slightly as a custom calculation script in the multi-line textfield like this:
event.value = "Good morning " + this.getField("name3").valueAsString + ",\n\nThis is a paragraph that will continue. Add date here " + this.getField("date3").valueAsString +" and as it continues it will go on, enter identifying number of individual here "+ this.getField("identity3").valueAsString+" and finally enter the time here "+ this.getField("time3").valueAsString+" .";
The slide below shows the end result which can then be copied and pasted in an email draft:
Is this what you're asking?