Expand my Community achievements bar.

SOLVED

How can I make items visble and accessible if you select yes and not so if no?

Avatar

Level 2

At current i am working on a form where you have a yes and no option if you select yes you must then select a level of risk low, med or high. I would like the items to only be able to be chosen if yes is selected.

Please help!!

Mustbeluck

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I have attached a sample that changes the state (access property) of the checkboxes form "ReadOnly" to "Open" (selectable) if the "Yes" radio button is selected.  The script will also clear the checkboxes if the "No" radio button is selected.

The script is on the "Change" event of the Radio Button group.

Regards

Steve

View solution in original post

10 Replies

Avatar

Former Community Member

So make the Risk field visible if yes is selected and invisible if it is not selected.

Paul

Avatar

Correct answer by
Former Community Member

I have attached a sample that changes the state (access property) of the checkboxes form "ReadOnly" to "Open" (selectable) if the "Yes" radio button is selected.  The script will also clear the checkboxes if the "No" radio button is selected.

The script is on the "Change" event of the Radio Button group.

Regards

Steve

Avatar

Level 2

Thats brilliant thank you!! Sorry to be a pain but how do you do that? Is it scripting if so how you i find that in livecycle and do it? Also sorry another question if i someone selects a radio button by accident and in fact they dont want either how do i set it up so they can cancel it!!

Thank you

Mustbeluck

Avatar

Former Community Member

Yes, I did use JavaScript to control the behaviour of the checkboxes.  You can view the script using a scrip editor window in LiveCycle Designer.  By default it is located at the top of the screen (see attached screen shot).

If the Script Editor has been closed, you can open it from the Window menu, select "Script Editor"

As for the radio buttons being cleared, you would need to add script to do this.  I have attached a new sample with a button to do this.  The script is on the "Click" event.

Regards

Steve

Avatar

Former Community Member

I have a variation on this. I am working on a table that sums quantities. Quantities of the item are entered in one of four categories: B, C, D, E. At the bottom of the table, the quantities for each category are totaled. I would like to make a subform containing a text box VISIBLE if there are ANY quantities entered in category E; if no quantities are entered, I would like it to remain HIDDEN.

My inclination is that if the Totals Numeric Field is greater than 0, then the Text Box would be visible, else, hidden. Something like this:

if (Subform33.OtherSubform.AnimalNos.details.Total.Totals.TotalE.rawValue > 0) JustifyE.presence = "visible";
else JustifyE.presence = "hidden";

But I can't get this to work, trying various things. One thing I think is the problem is that the above is javascript, and the sum script I have is formcalc.

Avatar

Level 6

Your script is close, but it's in the wrong place.  You have it in the initialize event for cell E, so it will only execute once when the form is loaded up.  Place the following script in the layout:ready event of the JustifyE textfield (I used FormCalc for this one):

if ( xfa.resolveNode("form1.#subform.Subform33.OtherSubform.AnimalNos.details.Total.Totals.TotalE").rawValue > 0 ) then

$.presence

= "visible"

else

$.presence

= "hidden"

endif

Avatar

Former Community Member

This didn't work for me. I copied and pasted it in the  layout:ready event of the JustifyE textfield, using FormCalc. What am I missing?

Avatar

Former Community Member

Here it is with the script added as described. The box is hiddent, but what I want is for it to be visiable if ANY numbers are added to the Category E spaces. (If Total E is greater than 0?)

Thanks!

Avatar

Level 6

The form is working fine.  You have the form saved as a static pdf.  Re-save the form as a dynamic pdf.  If you're previewing it in Designer, make sure you have the preview type set to Interactive and preview as set to Dynamic.

Avatar

Former Community Member

Thanks! It works. I REALLY appreciate the help!

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