Copy Fields no longer working

driv 24 Sep, 2016
Hello,
I had previously been using this technique to copy data from one set of fields to another.
http://www.chronoengine.com/faqs/2690-how-can-i-automatically

It was working well until I had to convert the form from a tabbed form to a multipage form.
(I only changed the containers to *pages* rather than *tabs* - the code remained the same.)

So I'm not sure if there is something about the multi page setup that would interfere?

I have one column with an ID of billiing_data
I have one column with an ID of shipping_data
I have a 'copy' button with an ID of copy_address

In the billing_data column are fields with ID's like...
company_address
company_town

In the shipping_data column are fields with ID's like...
invoice_address
invoice_town

The on load LoadJavaScript is


jQuery(document).ready(function (jQ) {
  jQ('#copy_address').on('click', function() {
    var inputs,source, source_id, target_id;
    inputs = jQ('#billing_data :input');
    jQ.each(inputs, function() {
      source = jQ(this);
      source_id = source.attr('id');
      target_id = source_id.replace('company_', 'invoice_');
      jQ('#'+target_id).val(source.val());
    });
  });
});


So as I said, this worked perfectly until I changed to a Multipage form.

Any thoughts what I could be doing wrong?

This is private content



Many thanks!
driv 24 Sep, 2016
Ah ha! The penny has dropped!

Of course, the Load JavaScript should be on On page 2.

Ah well you live and learn.

I wonder if that's one for the FAQ, Bob?
(But then again maybe others aren't as thick as I am.😟 )
GreyHead 25 Sep, 2016
Hi driv,

I updated the FAQ a little.

Bob
This topic is locked and no more replies can be posted.