populate submitted email subject line with data from livecycle form text field - livecycle

I have a pdf form created in Livecycle it is set up with a submit button and will submit a pdf of the form via email.
NOW I want to have the subject line of the email come from on of the filled out fields in the form. for example: client name field will populate the email subject line with whatever is typed into the client name field.
I'd also like to know how I can reduce the file size of the form it's 2mbs currently.
Can anyone help? Thanks in advance.

With the ready-to-use Email submit button you can't dynamically set the subject.
However, you can create your own button to submit the form by email and use a script to dynamically set the subject and send the email:
drag a regular button into your form,
open the script editor for the click event (more info),
set the language to JavaScript and
use a script like the following:
// Replace with actual path to the field which contains the subject:
var subject = path.to.field.rawValue;
var myDoc = event.target;
try {
myDoc.mailDoc({
bUI: false,
cTo: 'receiver#domain.com', // Replace with actual receiver mail address.
cSubject: subject,
cSubmitAs: "PDF"
});
} catch (e) {
// exception handling...
}
You can find more in-depth information here: http://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address. In this tutorial not the subject but the receiver mail address is set dynamically, but you can apply the same principle to any of the parameters of the doc.mailDoc(...) function.
Regarding your question on how to reduce the file size: either your form is veeery large or you have images with large file sizes embedded in the form. In the latter case search for ways to reduce the image file sizes. For example, check if you are using .jpg or .gif or .png files and not .bmp files (which are uncompressed and hence very large) or use images with a lower resolution (72 dpi is ok for screen display).

Related

Is there any way to autopopulate form fields based on a JSON file that will be uploaded via a Load button in ReactJS

I am trying to make an application that would have a form that gets autofilled once the user uploads a JSON file and clicks the load button , so I was wondering if there's any way to achieve this .
Thanks
That's totally possible. Just make the file upload write a JSON to state (https://www.geeksforgeeks.org/file-uploading-in-react-js/) and then when the user clicks a button, scan through the uploaded JSON for the relevant keys. When you find a key, just use the value associated with it and set the state value of the associated form element.

How to validate form field with Parsley JS if field input has been populated automatically?

I have a signup form where the user is supposed to enter amongst other personal details also his phone number's country prefix (e.g. '+49' for Germany). Now I have a script running which automatically detects the country prefix according to the user's IP geo location.
If the IP location is successfully determining the user's current location, it puts the country code automatically in the signup form's prefix field.
This means that the user doesn't have to enter the prefix manually.
My question is: once the signup form is loading, and all fields are empty except for the country prefix, how can I validate the country prefix field successfully prior to hitting the submit button?
I tried all kinds of triggers from the jQuery Events page as suggested by the ParsleyJS documentation but I don't get it done..
Any help on this would be gladly appreciated!
Edit to further clarify: If you're visiting the signup page, the IP location script detects your location, translates that into your country's phone prefix, and puts that number into the "Prefix" form field. So you don't have to put there anymore by yourself. This works only if the the IP locations script successfully identifies your location of course, however this works in most of the cases. So what I would like to achieve is that this form gets it's green validated background, although you didn't put in the prefix yourself. In other words, the prefix is already in the field in most of the cases.
I'm using the data-parsley-triggers, no jQuery or JS to validate the whole form.
You can see in the picture that I entered a first name, Foo, which validated upon data-parsley-trigger="change". The blue arrows show the fields which have been filled automatically by the IP location - and they are not validated as I'm missing the right trigger.
It's not clear what you are trying to achieve (why validate the field when it's clear it will be valid), but why not simple $('input[name="phone_prefix"]').parsley().validate()?

map added to form with ability to add polygons and submit via email

I currently have a section on my website where I ask users to input information on various criteria and the answers get emailed to me (a form with submit button). I would like to add a map to the form in which users can draw shapes such as polygons and circles. Once they submit the form, I would like the map to be emailed along with the other input criteria to me. What is the best code to use?Thank you.
Never too late ...
You can let the browser open a mail client and send the shapes in the body of the mail.
var text=JSON.stringify(drawnItems.toGeoJSON());
window.open('mailto:test#example.com?subject=subject&body=' + text);
Here is a full example

Send file to server through iText PDF?

I'm dynamically creating some PDF files through my application, using iText, and I need to use several components (TextField, CheckBox, RadioButtons etc), and then submit the values to server. But, one of the requirements says that the user needs to be able to select and send files along with the other values. I did not find a specific component to this, and so I'm asking for some help with this situation.
Is there a way to create some kind of Input File, File Chooser, etc, and attach it on the generated PDF file? And then send this selected file to server?
Thanks
This is explained in the official documentation, more specifically in the example FdfServlet of chapter 9 of my book. However, in this example, we add a file selection field to an existing PDF, so I've made you an example that explains how to create such a field when creating a document from scratch: FileSelectionExample
A file selection field is created just like any other text field, except that you have to set a flag using the setOptions() method. If you want a file chooser to appear, you also have to add a JavaScript action:
TextField file = new TextField(writer, new Rectangle(36, 788, 559, 806), "myfile");
file.setOptions(TextField.FILE_SELECTION);
PdfFormField upload = file.getTextField();
upload.setAdditionalActions(PdfName.U, PdfAction.javaScript(
"this.getField('myfile').browseForFileToSubmit();", writer));
writer.addAnnotation(upload);
In the full example, I also added a second field and after selecting the file with the browseForFileToSubmit() method, I set the focus to that other field. I'm doing this because the file name only becomes visible in the file selection field after that field loses focus.

TextProperty field in NDB gets "=" appended after every line

I have very strange case which I wasn't able to debug for a day.
On my front-end I have form with textarea and submit button.
On submission, the textarea field gets saved as ndb.TextProperty()
When I submit a multiline text, the text in the database gets = or =20 characters on every line. At first I thought they get randomly inserted, but it seems every 76 characters gets one = character.
This gets really hard to debug as on my localhost instance it works perfectly fine, but on the deployed version it doesn't. They are both in sync. Also on my localhost instance the text field on the datastore entity shows correctly the newline and tab characters, but on the deployed version, the datastore field is shown as one text blob without newlines or tabs.
Anyone can guide me to the right direction ?
Oh, BlobStoreHandler you didn't mention that in your original question.
Ok there is your problem.
I don't believe you can combine the two. If you are uploading to the Blobstore you can't do other form elements, as the upload is directed to the BlobStore service.
From the docs
The user creates a blob by submitting an HTML form that includes one
or more file input fields. Your application calls create_upload_url()
to get the destination (action) of this form, passing the function a
URL path of a handler in your application. When the user submits the
form, the user's browser uploads the specified files directly to the
Blobstore. The Blobstore rewrites the user's request and stores the
uploaded file data, replacing the uploaded file data with one or more
corresponding blob keys, then passes the rewritten request to the
handler at the URL path you provided to create_upload_url(). This
handler can do additional processing based on the blob key.
So it's difficult to say exactly what is going on without seeing your code, but I seriously doubt you can do what you are trying to achieve.
I've also had the same problem,
I solved it in a way that isn't elegant, but functional:
I did a replace on the input;
here is the code
input_html_text = unicode(self.request.get('text')).replace('=\r\n', '')

Resources