Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Validate required fields upon clicking the signature field in LiveCycle Designer

Avatar

Level 1

I am trying to figure out how to verify that all required fields are filled upon clicking the signature field. Currently, they are only being verified after the digital signature is added and the submit button is clicked.

 

Upon adding a digital signature, the form has you save it locally. We are finding that users are just emailing the saved signed copy rather than filling the required fields when the submit button is clicked.

 

I'm pretty new but am a quick learner.

 

Thank you.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Employee

Hi @makivelli,

Thank you so much for sharing the information; the use case that you have specified is vert much feasible. To implement the use case you will need to write a custom JS, which will be called on the pre-sumitt event of the button. The sole purpose for the button will be to go through all the fields in the forms and highlight if there are any fields which are mandatory and not filled. If they are able to find some fields, then the submit action will be terminated there and you can also highlight the field to allow users to understand why the action was terminated.

 

Please let me know if you need any additional information on the same.
Thanks

Pranay

Avatar

Level 10

You can use a script with a recursive function to collect all empty mandatory fields and cancel the submitting attempt if any is found. This can be executed in the preSubmit event for example.

//Recursive function to find all empty mandatory fields
function checkMandatoryField(oNode, aList) { 
    if (oNode.className === "field") {
    	if (oNode.validate.nullTest === "error" && oNode.isNull) {
        	aList.push(oNode.name);
        }
    } 
    for (var i = 0; i < oNode.nodes.length; i += 1) {
        checkMandatoryField(oNode.nodes.item(i), aList);
    }
}
// Call function, first parameter is the name of the forms root element. 
checkMandatoryField(form1, aList = []);

// If there are any fields founds
if (aList.length > 0) {
	// Show a message
	xfa.host.messageBox("Please fill the following fields first:\n" + aList.join("\n"));
	// Cancel planned action
	xfa.event.cancelAction = true;
}