Expand my Community achievements bar.

SOLVED

Enabling-disabling objects

Avatar

Level 2

i have a form which consists of several checkboxes and text or numeric fields. i want checkboxes to control the visibility of the other fields. i use the following script:

ygh.#subform[0].checkBox1::change - (JavaScript, client)
if(this.rawValue==0)
  numericField2.presence="invisible";
else
  numericField2.presence="visible";


it works fine... but initial page comes with fields that are all enabled. according to the checkbox changes, they respond, but i want to see them disabled on the first screen.

by the way, when i change the visibility option to "Invisible" in the object->Field tab, it succeeds but then the script does not work at all.

any solutions or offers will be appreciated.

thanks in advance.

MC

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Change the check box access property to "readOnly". For example, form1.page1.cb.access = "readOnly";

To make the check box user entered optional change the check box access property to "". For example, form1.page1.cb.access = "";

Rather than use "invisible" use "hidden".

Steve

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Change the check box access property to "readOnly". For example, form1.page1.cb.access = "readOnly";

To make the check box user entered optional change the check box access property to "". For example, form1.page1.cb.access = "";

Rather than use "invisible" use "hidden".

Steve

Avatar

Level 2

used access attribute to control the fields like you said. works fine.

thanks a lot.

MC

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