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.

Need form to open with highlights defaulted to on, but...

Avatar

Level 2

When I try copying in


app.runtimeHighlight = true;

to docready, and then F5 (preview), the field hi's don't show by default.

I also tried

if (!app.runtimeHighlight){
     app.runtimeHighlight = true;
}

for layout ready, but still no luck.

What am I doing wrong? Thanks.

11 Replies

Avatar

Level 10

Hi,

The script should work perfectly in the docReady event:

app.runtimeHighlight = true;

Check that the language is set to JavaScript. Also when previewing make sure that the Preview Type is set to "Interactive Form", in the File > Form Properties > Preview tab.

See example here: http://assure.ly/jiZ6tn.

Does that work?

Niall

Avatar

Level 2

Thanks but DocReady (along with 95% of the drop-down) is greyed out ..unless I'm on a specific field. I don't want to put this at any particular field. I want to be at the root I guess.

How do I make sure I'm at the root?

Also, when I paste the color code from that form, I assume I'm putting it just below the existing line 1, or:

" form1.page1::docReady - (JavaScript, client)"  ?

Also, on save, I get the following:

"Failed to save the file. Additional error information can be found in the Log tab of the Report pallette."

and the first line of the color code pasted in, gets pink highlight (error I guess), namely:

" form1.#pageSet[0].Page1.header::docReady - (JavaScript, client)"

I'm wondering if there's a conflict between the 1st line that was already there and the first line of the new code (pasted after the already-existing one):

ALREADY THERE:   form1.page1::docReady - (JavaScript, client)


FIRST LINE OF COLOR CODE:  form1.#pageSet[0].Page1.header::docReady - (JavaScript, client)

Thanks for clarifying these points.

David

Avatar

Level 10

Hi,

If you are copying script from one object to another, you must not paste in the reference syntax. This does not have a line number and is not part of the script.

The reference syntax gives you the full SOM expression for the selected object, the event that you are scripting in, the language and where the script will run.

Delete duplicates of these lines from your script.

You can place the code from the example in the docReady event of the root node. This is normally "form1", unless you have imported an exiting document into LC Designer, in which case the root node is something like "TopUpperMostSubform".

The highlighting will apply to all fields that are not set to readOnly.

Hope that helps,

Niall

Avatar

Level 2

1. Does the script have to come first in docready or can it be anywhere within that root?

2. Are manual code changes mode only in XML view?

3. I notice lines (maybe "SOM"s?) can not be changed, so...about those 2 conflicting lines, you said to delete one, I'd like to delete the one that was "already there" and not the one that goes with the script, but it seems like those existing lines can't be changed...at least in script area, maybe in XML view.

My docready* starts with this code:

form1.page1::docReady - (JavaScript, client)

////RIGHT HERE, I DELETED YOUR DUPLICATE LINE 1 (since I couldn't delete the above line////

if (app.viewerVersion >= 10)
{
    this.border.fill.color.value = "86,86,86";
}
else if (app.viewerVersion >= 9 || app.viewerVersion < 10)
{
    this.border.fill.color.value = "51,51,51";
}
else
{
    this.border.fill.color.value = "103,103,103";
}

form1.#pageSet[0].Page1.header.AssureDynamicsURL2::docReady - (JavaScript, client)

if (app.viewerVersion >= 10)
{
    this.border.fill.color.value = "86,86,86";
}
else if (app.viewerVersion >= 9 || app.viewerVersion < 10)
{
    this.border.fill.color.value = "51,51,51";
}
else
{
    this.border.fill.color.value = "103,103,103";
}

However, my highlighting is still NOT showing by default / on form open.

Please remember, I'm brand new at this.

Thanks.

Avatar

Level 10

Hi,

I have gone now so won't be able to help much.

However NEVER, EVER script in the XML Source view. All scripting in the Script Editor (see Help).

The script that you have copied relates to a button on my form. Do not copy this script. All you need is the app.runtime.Hightlight = true; line.

Niall

Avatar

Level 2

ah ok will do.

I think you meant app.runtimeHighlight = true;

you added an extra "t" and an extra period.

goodbye

Avatar

Level 10

Yes, typed on a phone while bombing down the road (passenger)

Avatar

Level 2

interesting.

I added the line. Still not working for me:

My first 2 docReady* lines read:

form1.page1::docReady - (JavaScript, client)

app.runtimeHighlight = true;  //this is the one I pasted after the above pre-existing line//

Still, fields are not defaulted to highlights on.

What am I doing wrong??

Avatar

Level 10

Hi,

I would need to see the form, but gone until Monday. Can you upload the form to Acrobat.com, publish it and the share the link here?

Niall

Avatar

Level 2

will consider. what's the link?