Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How do I associate a checkbox response to a specific part of my form?

Avatar

Level 2

I've created a form that depends on the employee classification to determine which column is used to fill in the information to be submitted to payroll.  Using global field definitions, I've created a second form duplicating the information from the first form to populate the fields of the second form.

What my boss wants to know is there anyway to associate the checkboxes to the appropriate columns?

I'm not sure even how to word it so I can search the Help.

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Don't put it on enter ...put it on change. When the enter event happens the value of the checkbox is not set so the code to put your cursor in the field is not executing.

Paul.

View solution in original post

9 Replies

Avatar

Former Community Member

Not sure I follow ....the checkboxes are getting duplicated down below. Can you elaborate on teh effect that you want?

Paul

Avatar

Level 2

If I select the "Classified" checkbox, I want to be directed to the "Classified Hours" column. From there I would enter the data and go to the next field down using arrow keys to navigate rather than having to tab through the entire form.  Same thing if I select the "Certificated" checkbox, I want to be directed to the start of the "Certificated Days" column.

Does that explain it more clearly?

Marlana

Avatar

Former Community Member

Ok I think I understand. I would check the value of the checkbox on its change event and then if it is set on then reposition th ecursor to the desired field. Something like this (using javascript):

if

(this.rawValue == 1){

     xfa.host.setFocus("Table1.Row.CertificatedDays0");

}

This code woudl be on the Certified checkbox. The same coudl woudl be on the Classified checkbox but the target for the SetFocus would go to the Classified field:

if

(this.rawValue == 1){

      xfa.host.setFocus("Table1.Row.ClassifiedHours0");

}

If the user unchecks the checkbox then nothing will be done.

Hope that helps

Paul

Avatar

Level 2

I'm a newbie at this.  Is the formula below Java? (sorry)

Marlana

Avatar

Level 2

Okay.  I see where it's Java.  Will the Java script impact the global field bindings I'm using to duplicate the information elsewhere?

Thanks.

Avatar

Former Community Member

Its Javascript and no it will have no effect on the global binding property.

paul

Avatar

Level 2

I selected "enter" in the Show window, JavaScript for the language, and Client in the Run window.  I copied and pasted the formulas into the script editor starting with the if.  I went to the preview mode and madea selection and nothing happened.  I was expecting the cursor to go to the selected column.

What did I do wrong?

Thanks.

Avatar

Correct answer by
Former Community Member

Don't put it on enter ...put it on change. When the enter event happens the value of the checkbox is not set so the code to put your cursor in the field is not executing.

Paul.

Avatar

Level 2

Thank you very much. It works great.  I appreciate all your assistance.

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