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

Invisible to Visible to Invisible - Filled fields turning back invisible after save/close

Avatar

Level 2

Good morning,

I've spent the better part of the last couple hours trying to develop a workaround to my current dilemma.

I have a dynamic PDF that has a bunch of invisible fields in it.

The user, by input of a drop-down, triggers a javascript switch which sets visibility for text fields in the form accordingly.

The form itself works fine initially. But when one of my users saves the PDF with filled in information (using Reader with Extended Rights).... when the file is reopened all visible fields set their presences back to default (which is invisible). None of the data is lost, it just looks like the presence flip-flops back to invisible.

My planned workaround to this has been to build a Doc:Ready event that will serve to check every invisible field when the file opens and set non-empty fields to visible. However, I've been having difficulty with the text fields evaluating correctly.

if

(DocumentAffected1.length > 0){

DocumentAffected1.presence

= "visible";}

I've tried Length, RawValue... used "0" and ""... and nothing seems to be working.

Is there a better way to check if my text fields have data? And if so, could you provide some example code?

I'm not a strong coder. All of my Javascript has been pinched from examples elsewhere in this forum. But it's nothing more than simple IF's and Switches.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Sounds like you need to save the state of your form as well. You can do it through code or you can let the product do it. Under File/Form Properties click the Default tab and choose the Automatically radio button on the preserve scripting changes option.

Paul

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

Sounds like you need to save the state of your form as well. You can do it through code or you can let the product do it. Under File/Form Properties click the Default tab and choose the Automatically radio button on the preserve scripting changes option.

Paul

Avatar

Level 2

Thank you very much. This was exactly the answer I needed.

Now I can drop all the Doc:Ready stuff.

Works like intended now.


Thank you for your help!

Avatar

Level 2

Hi,

Can you please guide me on this.

I am not getting the actual output. My data lost and am seeing the first page again or sometimes getting partial data.

radio event action not happening. It only selected the radio option but no action on it.

sivamaddy

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] ----