Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

I have 2 text fields that are exactly same & want the 1st instance to automatically populate the 2nd

Avatar

Level 2

I have another form in LiveCycle Designer ES where 2 text fields that are exactly the same at different parts of my form. It's a common question perhaps, but I need the 2nd instance to automatically populate AS SOON AS the first one is filled in.

Basically I created a checkbox where customer ticks if "shipping same as billing address". What I want is this: As soon as that box is checked, I want those duplicate fields to fill in automatically with the already-filled in shipping info.

Thank you.

6 Replies

Avatar

Level 9

Hi,

If you want both the fields to have same value just after entering value to one field without clicking the checkbox then you can do the following.

  - Set the fields to the same name. If it's TextField1 and you have another TextField2 rename the latter field toTextField1. Automatically it will make the first field as TextField1[0] and the second field as TextField1[1]. Then you can set the binding of the 2nd field as global, so that it will automatically display the same value after you exit from the first field by entering some value.

If you want to click the checkbox first, so that it will display the same value in the latter text field, then you can put the following script in the click/change event of the checkbox.

if (shipping same as billing address.rawValue == 1)

{

   billingAddress.rawValue = shippingAddress.rawValue;

}

Thanks,

Bibhu.

Avatar

Level 2

Bibhu,

Thanks so much for your reply.

1. OK, for the  duplicating fields part, thanks, that worked.  But as I look at it now,  it gave us a chance to see it "from the customer's point of view" which  you know is always best. So, it was cool 'n all, but I think, from the  customer's point of view, maybe we should have them use the checkbox AS  WELL. Allow me to explain:

It's neat that the fields duplicate to billing section in real time.  That will save them a lot of time. However (and I know it's a  strange-sounding question because I've set the Billing Fields now to  global), but I'd like them to be able to EDIT the billing fields AFTER  they've duplicated down WITHOUT now (I know I know) changing the  shipping address.

I thnk that would be the coolest way (then I'd delete the checkbox  altogether). IF that's not possible (to edit the duplicated fields a  little without changing the shipping fields), then here's something sort  of fun that I thought of:

The fields would copy down (like we've already done, by converting  those billing fields to global with matching names) ...AND I'll have the  checkbox ticked by default. THEN I'll change the mouseover on the  checkbox to "UNCHECK this box to edit billing address if different than  shipping". That's where I'd need your help: If there's a script or  something that would tell the form "uncheck to change the billing  address fields to "normal" (from global). That way they're pre-filled in  (for the 90% of customers whose addresses are usually the same) but it  will allow those other 10% of customers to edit the address by simply  unchecking the box and typing over the few fields in billing that are  different.

By the way, for the script you gave, I couldn't find the  click/change event of the checkbox. Is that another name for the  "Validation Script Message" box?

Thanks for your help so far.

Avatar

Level 9

Hi,

First of all I want to clarify click/change event. What I meant here is either change event or click event. I should have explained it in detail .

My suggestion :

   We can write somescripts in the exit event of ShippingAddress so that it will show the same value in the Billing Address, The by default value of the check box would be checked.

   Now if the user wants to change the Billing address then he can change that and by doing so it will uncheck the checkbox. We do not need global binding here.

Is it ok to do ?

Thanks,

Bibhu.

Avatar

Level 2

Bibhu, Genuine apologies. I posted my reply about a week ago, something like  "absolutely! thanks" but logging in, but my response didn't make it thru and I checked and mail was returned. YES, I'd really appreciate your help. I have 2  forms:

1. the one we were about to work on form for the billing/shipping address with  checkbox you'll help with some scripting so that as soon as they UNcheck the "same as shipping box" (which will be on by default with a mouseover that says "UNcheck to revise the billing address). Thanks 10x.

2. This form (and another) have an even more basic problem: they won't even distribute. Seem my earlier post (i think was within about 5 posts of this one originally). I still can't find the error.

Thanks in advance.

Please let me know how I can get the form (1. above) to you. Thanks Bibhu.

Avatar

Level 9

Hi,

See my reply below.

In the exit event of the Shipping addres :

if (Billing_Address.rawValue != null)

     {

          Billing_Address.rawValue = this.rawVale; // Shows the same values of Shipping Address in the field of Billing Address.

          CheckBox.rawValue = 1;  // Makes the check box "Checked".

     }

In the mouseEnter event of the checkBox.

if (this.rawValue == 1)

     {

          app.alert("UNcheck to revise the billing address.");

     }

in the change event of the checkbox .

  if (this.rawValue == 0)

     {

          Billing_Address.rawValue = null;  // Makes the previously filled value of Shipping address as null.

     }

Hope this helps.

Thanks,

Bibhu.

Avatar

Level 2

Thanks. The problem is that when the checkbox is unchecked, and you try to then edit the lower (Billing) field, it changes the original upper (Shipping) field. Please note: my correct/new form has Shipping first then Billing second. I reposted this for greater clarity and appreciate your continued help.