- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi,
First, because your test looks at if the field is null and if so makes the field mandatory, will not provide the best user experience. The user won't have seen that the fields are mandatory until their start the submit process. Sometimes it is useful to turn on/off the mandatory property if certain conditions are met as the user fills in the form. However because you are just checking that it is not null, I would recommend that you makes these fields mandatory in the Object > Value tab. Change the type to "User Entered - Required". You can then lose the script in the preSubmit event.
This way as soon as the user opens the form they can see the mandatory fields, which will be outlined in red when the highlight fields is clicked.
Just a suggestion.
Now in relation to the signature field - you can access its state within Acrobat using signatureValidate(), which is an AcroForm function not an in-built XFA function:
var oState = event.target.getField("form1[0].page1[0].SignatureField1[0]").signatureValidate();
if (oState != 0)
{
EmailSubmitButton1.execEvent("click");
}
else
{
xfa.host.messageBox("You have not signed the form. \n\nPlease click OK and then click the signature field to sign the form. \n\nThank you!", "Error submitting this form", 0, 0);
}
The user will not be able to submit until the form is signed.
Sample here: https://acrobat.com/#d=Paj9XDR-8TOixSVXrYrX9g
Good luck,
Niall