Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Activating a button after signature field is signed

Avatar

Level 3

Hi,

I have an email button to submit the form. I was wondering if I can disable it and put a condition. If the signature field is signed then button will be enabled.

regards

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Sorry ...now I understand your request ......here is your form back with the code added to the email submit button. I am only checking one signature (the Staff Signature).

Paul

View solution in original post

10 Replies

Avatar

Former Community Member

Here is some code that will allow you to check the signature field:

// check to see if Claimant signature field is signed.
var oSOM = claimsign.somExpression;  // Returns the full SOM expression i.e. xfa[0].form[0].form1[0]...
var truncSOM = oSOM.substring(15); // Truncating 'xfa[0].form[0]' from SOM to get acroforms name of the field.
var oState = event.target.getField(truncSOM).signatureValidate(); // Get the current field's signed state

In this case the signature field is called claimsign. After running this code the variable oState will conatin a value ....if it is 0 then the field is not signed. So you can add code like this:

if (oState == 0 ) {

     // signature field is not signed

     app.alert("You must sign the form before submitting")

} else {

     //The signature field is signed

     go through your submission process code

}

Hope that helps

Paul

Avatar

Level 3

Hi,

Sorry I couldnt make it. Whihc code goes to where? When I use this codes anywhere in the form LC2 freezes and restarting.

Avatar

Former Community Member

I created a sample for you .....the code is on the click event of the button. The button acts like the submit button. Note that I did not add any code to do the submit I simply put a message box up to indicate that is where the submission would happen.

Paul

Avatar

Level 3

Hi,

Strange whenever I put this code LC2 freezes and restart. I upladed my original form, could yo give it a try please?

http://teomanefendi.fileave.com/FaultMaintenance_Reporting_Form%206A.pdf

Avatar

Former Community Member

Seems to work fine for me ....are you using Acrobat or Reader? Which button causes you the issue?

Paul

Avatar

Level 3

If you dont mind could you send me the same file please?

Avatar

Level 3

Hi Paul,

Yes I downloaded that but its not operating in my form. Thats why I asked you can you make the code work in my form or tell me whats conflicting with it?

Kind regards

Avatar

Correct answer by
Former Community Member

Sorry ...now I understand your request ......here is your form back with the code added to the email submit button. I am only checking one signature (the Staff Signature).

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----