Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to turn "On" the Highlight fields automatically?

Avatar

Level 5
Is there a way we can turn on and off Highlight fields feature automatically at the form load or page load?
10 Replies

Avatar

Former Community Member
All you need to do is place the following JavaScript in the top-level form object's ("form1" by default) Layout:Ready event:



app.runtimeHighlight = true;


This will turn-on field highlighting when the document is loaded.



I've attached a sample form which does this and also provides a button which, when clicked, toggles field highlighting on/off.



Stefan

Adobe Systems

Avatar

Level 4

So if you set this the form to open without the fields being highlighted (=false) but the users click the button in the upper right hand corner of the window that says "hightlight fields"  the fields will still highlight?  That button overrides your code?  Is there anyway to not ever have the fields highlight?  If someone prints a highlighted form and then faxes it - there is a problem with being able to read it.  Is there a way to "lighten" the highlights?

thanks!

Jodi

Avatar

Former Community Member
I have found that the Layout:Ready event tends to be more flaky than the initialize event. For instance, when I FIRST opened the attached pdf, the fields were not highlighted. But when I closed, and reopened, they were.



Also, on my own form, I added this in the top level subform, and the performance was the same (didn't work when initially opened).



But I changed it to the Initialize event and it works great.



Is there any reason to choose Layout:Ready over initialize?



Cheers!

Jay

Avatar

Former Community Member
That's interesting. It's possible you're running into a timing issue with the Layout:Ready event although what you're setting is an application (Acrobat) setting as opposed to a document (PDF) setting and therefore Layout:Ready should work just fine (it does for me, anyway, using Acrobat 7.0.7). Was Acrobat already opened when you opened the sample PDF or did opening the PDF also cause Acrobat to open? If Acrobat was closed, it's possible there was a timing issue.



The Initialize event occurs prior to the Layout:Ready event. As far as I understand it, Initialize occurs just after the data merge (if any, depending on your form) but before Layout:Ready. Layout:Ready is supposed to occur once all fields have been laid-out (rendered) on the form.



Should you choose Layout:Ready over Initialize? It depends on what you're trying to achieve with your form. If your script depends on visual elements being in place, you'd be best to use Layout:Ready but if your code depends more on data than UI, you're probably OK with Initialize.



If it works in Initialize, I would just leave it in Initialize.



Stefan

Adobe Systems

Avatar

Former Community Member
Hi Stefan,



In my program, I am trying to pop up a message box to the user when the form gets re rendered. Like, when the user click a radio button, some conditional formatting gets applied and after the formatting is finished and the form is re rendered, I want to show a message box to the users. I tried placing the message in Layout : ready event of the Page, but it is getting fired before the conditional formatting even starts.

I feel that none of the events get fired after form gets re rendered. Please let me know if this is incorrect.

Also, if you have any suggestion to my issue, it will be fantastic.



Thanks,

Sreeraam Mohuna.

Avatar

Former Community Member
I could not get the app.runtimeHighlight = true; code to work. I am placing it under the "initialize" module of my top-level form "F" as such:

---F::initialize - (JavaScipt, Client)-------------------

app.runtimeHighlight = true;



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



Am I missing something? Doesn't work in PDF preview or in Reader 7.0.8

Avatar

Level 5
try with 'docReady' or 'formReady' event. That should work.



Regards,

SekharN

Avatar

Former Community Member
No luck, but thanks. I don't get it. Seems simple enough.

Avatar

Level 1

I am doing everything same as written by all geeks but still its not working for me.

I you don't mind can I see your PDF, if your issue was resolved. Or is their any way that I can show you my PDF, so that you can look into it and guide me where I am mistaking. I am trying to do this in Lifecycle 9

let me know please  I am anciously waitiung for your rreply as it is very urgent.

If any one else has found a way please guide me

Thanks