Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Going to jump out a window if this code doesn't work!!! (kidding...)

Avatar

Level 2

But seriously, I need Underscores to disappear when a user starts typing in a Notes field and it does, but if the user did not type anything into the notes field, I need the underscores to appear so someone can handwrite notes.

Here's the code under Page1:

topmostSubform.Page1.UNDLN_1::initialize - (FormCalc, client)

// start script

if (NOTES_1.value <> "") then

UNDLN_1.presence

="hidden"

UNDLN_2.presence

= "hidden"

UNDLN_3.presence

= "hidden"

endif

--------------------------------------------------------------------------------------------------------------------------------------------

This does not work. As soon as I open the PDF document, these underscores are all hidden. The Notes_1.value should be "" since nothing has been entered.

I even the following code directly above the IF statement, and the underscores are still hidden when opening the PDF document.

NOTES_1.value = ""

I am at a complete loss.

Any insight is greatly appreciated...

-JoeF

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The lines are behind the NOTES_1 textfield object, so you have to click outside of an object and drag across the page to select the lines. Temporarily you could send the textfield to the back, work on the lines, and then bring the textfield to the front again.

There is a Line object in the Object Library. I just dragged it on an then set the appearance in the Object > Field palette.

Good luck,

Niall

View solution in original post

10 Replies

Avatar

Level 10

Hi,

One aspect is that in FormCalc you do not access the value of an object using .value (That is used when dealing with global/form variables).

I would be inclined to have the following in the docReady event of the NOTES_1 object:

if ($ eq "") then

     UNDLN_1.presence = "visible"

     UNDLN_2.presence = "visible"

     UNDLN_3.presence = "visible"

else

     UNDLN_1.presence = "hidden"

     UNDLN_2.presence = "hidden"

     UNDLN_3.presence = "hidden"

endif

If you have the script in a different object, then the if statement would look like:

if (NOTES_1 eq "") then

You could also check/run script in the exit event of NOTES_1.

Hope that helps,

Niall

Avatar

Level 2

It does help, but doesn't fix the problem(Unless I did something wrong)

I removed all other code related to this.

Then added the following, but have the same identical issue.:

topmostSubform.Page1.NOTES_1::docReady - (FormCalc, client)

if

($ eq "") then

UNDLN_1.presence

= "visible"

UNDLN_2.presence

= "visible"

UNDLN_3.presence

= "visible"

else

UNDLN_1.presence

= "hidden"

UNDLN_2.presence

= "hidden"

UNDLN_3.presence

= "hidden"

endif

Avatar

Level 10

Hi,

Just spotted topmostSubform, which indicates that you created the form by either importing a Word or PDF document.

This may mean that the form is not saved as a Dynamic XML Form in the file save-as dialog. If the form is not saved as dynamic, then features like .presence will not work (eg this is dynamic behaviour).

So first check if the form is saved as a Dynamic XML Form. If that option is greyed out then you are in trouble.

Niall

Avatar

Level 2

Whew....it's definitely a Dynamic XML form saved for compatibility with 9.2 and up.

I use Paperforms barcodes in this form as well.

Still....at a loss on how to make these Text Fields disappear.

Can I attach the file in this forum?

Avatar

Level 10

Good,

You can't upload the form to the forums, but you can upload to a file sharing site like Acrobat.com.

Then publish it and post the published URL here:

Acrobat.com publish.png

Niall

Avatar

Level 2

Wow...this is awsome!

Thanks for the great tip on publishing!!!!!

Here's the one with the code you helped me with:

https://acrobat.com/#d=KGpnYlBloVNlt7IlDPOnZQ

Here's the previous one:

https://acrobat.com/#d=g15oHp1EWo58lz7oD-qC*g

Thanks again for this great file sharing tip!!!!

Now...I really need to get those underlines removed when a user STARTS TYPING in the NOTES_1 field(and agaian and again for NOTES_2, NOTES_3, etc...)

Then, when the user opens the file back up, the underlines will not appear if anything was typed in the NOTES_x field. If NOTHING was typed, I need those underlines.

Seems easy in my head, but hard to work out. It looks like the code should work, but does not.

Avatar

Level 10

Hmmm,

I would be inclined to try and take a bit of the weight out of the form. I see what you are doing with the 0pt font size, but is it very involved form with a lot of objects.

I have set the field to limit to visible area in the Object > Field palette, so that the 0pt font works.

I have removed the three textfields and replaced them with lines. The lines should be placed behind the textfield object. I have gone for a light/grey line.

I have placed script in the enter and exit events of NOTES_1 object.

In the File > Form > Properties > Defaults tab I have set the Preserve script changes to Automatic, so that the form should open in the same state.

Here is the form back to you: https://acrobat.com/#d=*EQud*AiipgKNWrmfH5NBw.

I really hope that this helps,

Niall

Avatar

Level 2

I will test...how did you get the lines in there?

You are awesome and I will pay it forward the best I can.

Thanks again!!!

Avatar

Correct answer by
Level 10

Hi,

The lines are behind the NOTES_1 textfield object, so you have to click outside of an object and drag across the page to select the lines. Temporarily you could send the textfield to the back, work on the lines, and then bring the textfield to the front again.

There is a Line object in the Object Library. I just dragged it on an then set the appearance in the Object > Field palette.

Good luck,

Niall

Avatar

Level 2

You have accomplished what I have been trying to do for weeks. Thank you.

Thanks for the other tips as well!!!!!