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

Populate fields when checkbox is checked

Avatar

Level 1

I have a simple issue...

I have a simple form, which requires the user to type in a shipping address, and a billing address. I've added a checkbox, which I would like to populate the shipping address fields with the billing address fields if they are the same. This is so the user doesn't have to type them in twice. You've seen this in a lot of shopping cart checkout systems.

I know nothing about scripting in LiveCycle, but I think you can use Javascript? I am a little familiar with that, but not enough to get this done. Can someone help me out with this? I would appreciate it very much.

I realize there are some older solutions to this issue on other threads, but links are broken, and nothing has worked.

I attached the PDF in question.

Thank You

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Here you go .....the code is on the change event of the checkbox.

Paul

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

Here you go .....the code is on the change event of the checkbox.

Paul

Avatar

Level 1

The file seems like it is stuck in queue.... can you email it to me directly? rev.jason.luna(at)gmail.com

Avatar

Level 4

You can make it yourself...

You make an if statement into the checkbox, javascript:

if (this.rawValue == 1)

{BillingStreet.rawValue = ShippingStreet.rawValue.rawValue;

BillingCity.rawValue = ShippingCity.rawValue;

BillingState.rawValue = ShippingState.rawValue;

BillingZip.rawValue = ShippingZip.rawValue;}

you can make additionally

if(this.rawValue == 0 &&  BillingState.rawValue == ShippingState.rawValue && BillingZip.rawValue == ShippingZip.rawValue && BillingStreet.rawValue == ShippingStreet.rawValue.rawValue && BillingCity.rawValue == ShippingCity.rawValue)

{BillingStreet.rawValue = null;

BillingCity.rawValue = null;

BillingState.rawValue = null;

BillingZip.rawValue = null;}

will if the checkboxbutton was checked, the user didn't do any changes + the user unchecks it, delte the entries... if the user changed it even slightly it won't be delted.

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