Expand my Community achievements bar.

New to LiveCycle - Not Forums

Avatar

Former Community Member
In my personal life, outside of work, I help on a web development board, so I understand the frustration of people not doing their own dirty work.



I have spent the last couple days searching through Google, PlanetPDF, and this site trying to figure out two (seemingly) basic ideas.



1) I want to be able to scan in an already laid out document and just put the forms on top of it and then print out only the data. Basically, I figured out the first part. I can scan in the document and I can lay the forms over it, but I can't figure out how to only print the data I have typed in. What it is is that my company has 1000s of preprinted forms that I just want to be able to type the data and print it on to a template pretty much.



2) After we run out of these preprinted documents, we will be using a new layout made in Excel/LiveCycle. I have included a PRINT button onto the form, but I need some sort of verification that the required fields are filled in before it actually prints anything.

From my searches I understand that this needs to be javascript (which I know nothing about) and that if someone goes to File>Print is overrides this javascript. That's fine, it is an in-house document so all employees will understand what they need to do.



Basically, I am looking to print out user input, but not print the form itself and I am looking to have a print button on a pdf that verifies that all required forms have data.

I will except any link or walk through available, I just can't seem to find any straight forward answers, and most likely I am searching for the wrong term or the wrong place.



I am using LiveCycle Designer 8 - if that matters.



Thanks in advance for any help and I hope I explained my questions thoroughly.
1 Reply

Avatar

Former Community Member
Okay,



Well I found out my term "VERIFY" should have been "VALIDATE" but I figured out the answer to question 2



If you are having the same issue please use the script below.

I created a plain button and added this script the the "click" event.



// This script performs a series of checks to verify that any required fields

// contain data. In this case, each field is individually checked to verify

// that the value of the field is non-null or an empty string. If the value

// of the field is null or an empty string, an alert message is displayed

// indicating that data must be input into the field and the background color

// of the fillable area is changed to red.



// Use this variable to indicate if a field does not contain data.

var iVar = 0;



if ((Name.rawValue == null) || (Name.rawValue == "")) {

app.alert("Please enter a value in the Name field.");



// Change the color of the fillable area of the text field.

xfa.resolveNode("Name.ui.#textEdit.border.edge").stroke = "solid";

xfa.resolveNode("Name.ui.#textEdit.border.fill.color").value = "255,100,50";



// Set the variable to indicate that this field does not contain data.

iVar = 1;

}

else {

// Reset the fillable area of the text field.

xfa.resolveNode("Name.ui.#textEdit.border.edge").stroke = "lowered";

xfa.resolveNode("Name.ui.#textEdit.border.fill.color").value = "255,255,255";

}



if ((Address.rawValue == null) || (Address.rawValue == "")) {

app.alert("Please enter a value in the Address field.");



// Change the color of the fillable area of the text field.

xfa.resolveNode("Address.ui.#textEdit.border.edge").stroke = "solid";

xfa.resolveNode("Address.ui.#textEdit.border.fill.color").value = "255,100,50";



// Set the variable to indicate that this field does not contain data.

iVar = 1;

}

else {

// Reset the fillable area of the text field.

xfa.resolveNode("Address.ui.#textEdit.border.edge").stroke = "lowered";

xfa.resolveNode("Address.ui.#textEdit.border.fill.color").value = "255,255,255";

}



if ((City.rawValue == null) || (City.rawValue == "")) {

app.alert("Please enter a value in the City field.");



// Change the color of the fillable area of the text field.

xfa.resolveNode("City.ui.#textEdit.border.edge").stroke = "solid";

xfa.resolveNode("City.ui.#textEdit.border.fill.color").value = "255,100,50";



// Set the variable to indicate that this field does not contain data.

iVar = 1;

}

else {

// Reset the fillable area of the text field.

xfa.resolveNode("City.ui.#textEdit.border.edge").stroke = "lowered";

xfa.resolveNode("City.ui.#textEdit.border.fill.color").value = "255,255,255";

}



if ((State.rawValue == null) || (State.rawValue == "")) {

app.alert("Please enter a value in the State field.");

// Change the color of the fillable area of the text field.

xfa.resolveNode("State.ui.#textEdit.border.edge").stroke = "solid";

xfa.resolveNode("State.ui.#textEdit.border.fill.color").value = "255,100,50";



// Set the variable to indicate that this field does not contain data.

iVar = 1;

}

else {

// Reset the fillable area of the text field.

xfa.resolveNode("State.ui.#textEdit.border.edge").stroke = "lowered";

xfa.resolveNode("State.ui.#textEdit.border.fill.color").value = "255,255,255";

}



if ((ZipCode.rawValue == null) || (ZipCode.rawValue == "")) {

app.alert("Please enter a value in the Zip Code field.");



// Change the color of the fillable area of the text field.

xfa.resolveNode("ZipCode.ui.#textEdit.border.edge").stroke = "solid";

xfa.resolveNode("ZipCode.ui.#textEdit.border.fill.color").value = "255,100,50";



// Set the variable to indicate that this field does not contain data.

iVar = 1;

}

else {

// Reset the fillable area of the text field.

xfa.resolveNode("ZipCode.ui.#textEdit.border.edge").stroke = "lowered";

xfa.resolveNode("ZipCode.ui.#textEdit.border.fill.color").value = "255,255,255";

}



if ((Country.rawValue == null) || (Country.rawValue == "")) {

app.alert("Please enter a value in the Country field.");



// Change the color of the fillable area of the text field.

xfa.resolveNode("Country.ui.#textEdit.border.edge").stroke = "solid";

xfa.resolveNode("Country.ui.#textEdit.border.fill.color").value = "255,100,50";



// Set the variable to indicate that this field does not contain data.

iVar = 1;

}

else {

// Reset the fillable area of the text field.

xfa.resolveNode("Country.ui.#textEdit.border.edge").stroke = "lowered";

xfa.resolveNode("Country.ui.#textEdit.border.fill.color").value = "255,255,255";

}



// If all of the required fields contain data, then the iVar variable is set to

// zero, and a confirmation message is displayed.

if (iVar == 0) {

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);

}



This will validate the specified fields. I have not tested this on radio buttons or check boxes and I am sure something will have to be changed.

I am still looking for the answer to my first question and I will post here if i find it, if not and someone knows the answer please let me know.



Thanks again.