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

Check State of Signature Field

Avatar

Level 3

I have a multipage form with 18 differant signature fields. I need to initialize the form with Page 1 hidden and then after signing a certain field, that page becomes visible. My code is as follows:

PostSign for field form1.RCP_Form_Page1.Block_28.Suppliers_Signature is:

form1.ProcurementLetter_Page1.presence = "visible"

Initialize on field form1.ProcurementLetter_Page1 is:

if (form1.RCP_Form_Page1.Block_28.Suppliers_Signature == null) then

     form1.ProcurementLetter_Page1.presence = "hidden"

endif

The above code works until you close and reopen the form. When reopening, it defaults back a null condition because null in this case doesn't work. I have even tried adding ".rawValue" at the end of "Suppliers_Signature" and that doesn't resolve it.

I think the root question is, how do I test the if statement to show a true condition of whether or not the signature field is signed?

Thanks for all that reply!

Mallard27

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You could also try the docReady event, which is the last event to fire as the page renders. This may be better than the initialize event.

Good luck,

Niall

View solution in original post

5 Replies

Avatar

Level 10

Hi,

If you have a look at the example here, it should give you a direction on the script: http://assure.ly/m8mN0m.

Hope that helps,

Niall

Avatar

Level 3

Niall,

Thanks for the example. This code works great for a button press but I can't get it to work with initialize.

I need to initialize the form with form1.ProcurementLetter_Page1.presence = "hidden" only when the signature field (form1.RCP_Form_Page1.Block_28.Suppliers_Signature) is unsigned. When the field is signed, I am going to use the PostSign event to trigger the appearance of this page. Unfortunetly, I can't get this to work using your code listed in your example. If I hide the page, I can get it to reappear after signature but when you close and reopen, the page is gone again. Here is the code I used:

form1.InternalRoutingForm_Page2::initialize - (JavaScript, client)

var oState = event.target.getField("form1.RCP_Form_Page1[0].Block_29[0].Boeing_IPT_Signature[0]").signatureValidate();

if (oState == 0)

{

    form1.InternalRoutingForm_Page2.presence = "hidden";

}

With this code, the form initializes showing the page "visible" instead of "hidden" even though the signature field is unsigned; which means the page should be hidden.

Thoughts? This must be possible as you can do it with other fields.

Thanks,

Mallard27

Avatar

Level 3

I could not get the initialize to work. So instead, I did the following:

Initialized the page to check to see if the signature title field was null. If it was null, I hid the page.

I then added a text field over the signature field that stated "You must fill out the title before the signature field will appear".

I initialized the signature to test the title field for null. If null, hide the signature and show the text. else, hide the text.

I then set a change formula to the title that said to hide the text field and show the signature field.

Last, I added textfield.mandatoryMessage on the signature field to display a message if the title was null.

This is not what I wanted but is a work around. The only issue is that I have two signatures and pages I want to do this too. They all work except the second page won't show the mandatoryMessage.

-Mallard27

Avatar

Correct answer by
Level 10

Hi,

You could also try the docReady event, which is the last event to fire as the page renders. This may be better than the initialize event.

Good luck,

Niall

Avatar

Level 3

Niall,

That worked! Thanks so much!!!!

Mallard27