Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

HighlightingFields.pdf

Avatar

Former Community Member
I think I found the file HighlightingFields.pdf on the Adobe site somewhere but I am not sure.



This .pdf demonstrates how to highlight the current field that a form filler is working with, highlight fields that a form filler is required to fill, and use message boxes to provide feedback to a form filler.



There is a button that highlights all required fields that do not contain data. What I would like to do is highlight all fields that do not contain valid data according to a regular expression.



Can anybody help with modifying the code below to do this? Once I understand one example, I will use different regular expressions accordingly.



Here is the code from 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").stro
0 Replies