Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Question regarding scripting for check box autofill

Avatar

Level 1

Hello everyone.  First, let me say many thanks to all of the users as well as admins in this forum.  As a novice LiveCycle user, I have learned an incredible amount from searching on the forum and reading from others.  Now, on to my current question......

I am using a custom form created in LiveCycle ES 8.2, and am wondering how to empower a checkbox to automatically fill in (ie. "on") based on a number inputted into a Numerical Field using a range criteria.  To be more specific, I have (5) checkboxes that will be labeled as follows:

Name: CheckBox1     < 500

Name: CheckBox2     500 - 999

Name: CheckBox3     1,000 - 1,499

Name: CheckBox4     > 1,500

Name: Checkbox5     None

I want ONLY ONE checkbox to auto fill in based upon a number that I enter into the Numerical Field (called "NumericField1").  For example, if I enter the number "889", I only want CheckBox2 to auto fill in.  Unsure what script to use in the Script Editor for this.  Any help would greatly be appreciated.  Thanks so much in advance.

MJ

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

You're welcome. I added a second numeric field. nf1 is user-entered optional. nf2 is calculated read-only field to mimic your form. nf2 simply takes the value of nf1. I moved the radio button logic to the calculate event of the radio button exclusion group to produce the results below. I think that is what you are after. The updated form is attached.

Untitled.png

Steve

View solution in original post

4 Replies

Avatar

Former Community Member

Is this what you are after? I used a radio button exclusion group rather than check boxes, although I made the radio buttons appear like check boxes.

Untitled.png

Steve

Avatar

Level 1

Steve, thanks so much for the reply recommendation.  Yes, your recommendation worked well in performing the task I wanted.....but, unfortunately it is preventing another script that I had wanted to implement as well.  I am sure that there is a way to do both, but I don't know how to script it.  Here it goes:

the numerical field that is controlling the radio buttons iteself needs to be calculated by values which i input into other numerical fields.  Basically, I need the numerical field (which you have named "nf") to be calculated via the following script:

nf.rawValue = (29.7) * DropDownList5.rawValue * DropDownList5.rawValue * NumericField5.rawValue * DropDownList13.rawValue

I am attaching both a copy of the form as well as a sample of what the completed product looks like.


To re-iterate, I need the Field called "nf" to be calculated based on values pulled from the fields mentioned above in the formula, and I need that finished product value to control the radio boxes as you have already done.

FYI, if it would be easier for scripting purposes, the above script is for this:

GPM Flowed = (29.7) * (Orifice Flowed)squared * square root(Flow Pressure) * (Nozzle Coefficient)

Thanks again for taking the time to script exactly what I was needing for the radio buttons.

http://kmphydrants.com/downloads/Hydrant%20Inspection%20Form.pdf

http://kmphydrants.com/downloads/Hydrant%20Inspection%20Sample%20Form.pdf

Avatar

Correct answer by
Former Community Member

You're welcome. I added a second numeric field. nf1 is user-entered optional. nf2 is calculated read-only field to mimic your form. nf2 simply takes the value of nf1. I moved the radio button logic to the calculate event of the radio button exclusion group to produce the results below. I think that is what you are after. The updated form is attached.

Untitled.png

Steve

Avatar

Level 1

Worked great sir!  Thanks again for your assistance.

Matt

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