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

Strange things with checkbox

Avatar

Former Community Member

Hi! I have a strange problem: In liveCycle Designer ES 8.2 I have on Master Page checkbox "mycheckbox".

My code:

if(mycheckbox.rawValue == "0")
{
    myPage.presence = "visible";
}
else if(mycheckbox.rawValue == "1")
{
    myPage.presence = "hidden";
}

When I clicked on mycheckbox happen strange things - mycheckbox will not be checked! I don't understand what is wrong.

Matthew

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hello mathew,

  If you keep any interactive fields in the Master page like text field or check box, as Malcolm said you will loose the values in it.

This happens only when you try to hide some pages. because the form will be remerged again and it can bring back the values entered in the fields present only in      the body page. It will not hold any values entered for the master page. That is why your check box is behaving wierd. To get more clarity on this, keep a text field in the master page, and on its exit event, try to hide one of your pages on the form. When you preview the form and type the value on text field and exit from it, the text field will become null and also your required page will be hidden.

Your problem solution:

    For the check fields you want to have in Master page, maintain the duplicate hidden check fields in one of the body page. Try to assign the checked values to the hidden fields in the change event of check fields and retrieve the values back to the masterpage checkfields in the exit event.

This below should work for you in the events of master page checkbox:

form1.#pageSet[0].MasterPage1.CheckBox1::change - (JavaScript, client)

 

form1.page1.CheckBox2.rawValue = this.rawValue;

form1.page1.TextField2.rawValue  = this.rawValue;

if (this.rawValue = 0)

page2.presence = "hidden";

else

page2.presence = "visible";

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

form1.#pageSet[0].MasterPage1.CheckBox1::ready:layout - (JavaScript, client)

 

this.rawValue = form1.page1.CheckBox2.rawValue;

Hope this helps.

Regards,

Chaitanya

View solution in original post

9 Replies

Avatar

Level 5

Hi,

Can you clarify where your script is? ( click event, initialise event, etc.....)

and what is the myPage object, is it the current Page?

Regards

Malcolm

Avatar

Former Community Member

Hi, BarlaeDC, thank You for the answer. My script is here:

form1 --> Master Pages --> Page1 --> mycheckbox (click event):

form1.#pageSet[0].Page1.mycheckbox::click - (JavaScript, client)


if(mycheckbox.rawValue == true)
{
    myPage1.presence = "hidden";
}
else
{
    myPage1.presence = "visible";
}

myPage is page (not current) with textfields, and static text object inside (I have 15 similar pages: myPage1, myPage2, ... myPage15)...

I would like this: click on mycheckbox should hide / show certain pages...

Avatar

Level 9

Hi,

Why do you need to put the checkbox in the Master Page ? You can put this in other page I mean in Design view.

Thanks,

Bibhu.

Avatar

Level 5

Hi,

The problem seems to be the fact that the action you are performing using the checkbox causes the document to be redrawn and this appears to be what is causing your checkbox to loose its value. ( could possible be a bug in designer, but as I would recommend not placing interactive elements on the master page I think a different approach would be better).

Can I suggest that you move the checkbox from the master page to each page in your form ( I am guessing this is what you want as you are placing it on the master page) and if you where to place all the checkboxes and scripts in a subform and then create a fragment it would still mean you would only have to maintain one version of your checkboxes and scripts although they could be shown on all pages.

Hope this helps

Regards

Malcolm

Avatar

Level 10

Hi,

Another suggestion would be that if you leave the object on the Master page, then go to the Object > Binding palette and set the checkbox's binding to "Global".

Niall

Avatar

Correct answer by
Former Community Member

Hello mathew,

  If you keep any interactive fields in the Master page like text field or check box, as Malcolm said you will loose the values in it.

This happens only when you try to hide some pages. because the form will be remerged again and it can bring back the values entered in the fields present only in      the body page. It will not hold any values entered for the master page. That is why your check box is behaving wierd. To get more clarity on this, keep a text field in the master page, and on its exit event, try to hide one of your pages on the form. When you preview the form and type the value on text field and exit from it, the text field will become null and also your required page will be hidden.

Your problem solution:

    For the check fields you want to have in Master page, maintain the duplicate hidden check fields in one of the body page. Try to assign the checked values to the hidden fields in the change event of check fields and retrieve the values back to the masterpage checkfields in the exit event.

This below should work for you in the events of master page checkbox:

form1.#pageSet[0].MasterPage1.CheckBox1::change - (JavaScript, client)

 

form1.page1.CheckBox2.rawValue = this.rawValue;

form1.page1.TextField2.rawValue  = this.rawValue;

if (this.rawValue = 0)

page2.presence = "hidden";

else

page2.presence = "visible";

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

form1.#pageSet[0].MasterPage1.CheckBox1::ready:layout - (JavaScript, client)

 

this.rawValue = form1.page1.CheckBox2.rawValue;

Hope this helps.

Regards,

Chaitanya

Avatar

Former Community Member

I just checked your suggestion on the form and it was amazing Naill. It's really a simple solution to that big problem.

Regards,

Chaitanya

Avatar

Former Community Member

Hi! Thank you for all your answers! I just start work in Adobe Acrobat and LiveCycle Designer. Your advice was invaluable! I moved my checkboxes from Master Pages and now all work very well!

I noticed that the program has more bugs. I work with 15 pages. On each page I have tens of text fields and static text object. Several times the program has shut down (automatically). Apparently a lot of objects makes him problems. But anyway I love this program.

Thank You!

Matthew, Poland

PS. I'm sorry for my imperfect English

Avatar

Level 2

Hi Niall,

Just wanted to let you know that this suiggestion help me as well.

Great tip!

Ken

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