PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Simple Checkbox to copy fields

  1. This seems like it would be a pretty simple thing to add. Place a check box in between fields, if checked it copies from one to another, if unchecked it removes it. Example, you have a physical address field and a shipping address field. Add the option to click box ( or whatever ) if its the same and it copies the data from one to the other.

    Posted 12 years ago on Thursday January 19, 2012 | Permalink
  2. You can accomplish this with jQuery now, but we'll keep this logged as a feature request. Thank you for the suggestion.

    Posted 12 years ago on Friday January 20, 2012 | Permalink
  3. Chris, you would be my hero if you could explain how to do this. I have seen other post, but I do not know where to enter jQuery request. If you could give me simple step by step of where to enter this I would be eternally grateful.

    Posted 12 years ago on Saturday January 21, 2012 | Permalink
  4. tnorthcutt
    Member

    Jason, take a look at this example: https://gist.github.com/1677531. I simply added a checkbox before the second address block, and if the user checks it, the address is copied from the first one, all based on the IDs of the input elements.

    Posted 12 years ago on Wednesday January 25, 2012 | Permalink
  5. Thank you for that code Travis. I just found something similar on Google for a related topic:

    http://www.gravityhelp.com/forums/topic/repeatsame-information-in-a-form-autofill#post-47862

    I think your solution is simpler.

    Posted 12 years ago on Monday January 30, 2012 | Permalink
  6. Thank you for the reply. Where do I put this code. I tried in the header in my Genesis theme but it just writes the code on top of the page. Do I need to upload this file to a folder?

    Posted 12 years ago on Tuesday January 31, 2012 | Permalink
  7. If it is just printing the code rather than executing it, you have added it in the wrong place.

    Can you post your full header.php at pastebin.com or pastie.org and we can check for the syntax error. Thank you.

    Posted 12 years ago on Wednesday February 1, 2012 | Permalink
  8. cinchmedia
    Member

    I would like to see this explained better. Where do I put the following code within the header.php? I do not have an url to show, as I am in the beginning stages of this form. I want to list a billing and shipping address, with a checkbox to autofill the shipping if it is the same as billing. Thanks

    jQuery(document).ready(function($) {
    $('input#choice_13_1').click(function() {
    if($(this).is(':checked')) {
    $('#input_2_12_1').val($('#input_2_2_1').val());
    $('#input_2_12_2').val($('#input_2_2_2').val());
    $('#input_2_12_3').val($('#input_2_2_3').val());
    $('#input_2_12_4').val($('#input_2_2_4').val());
    $('#input_2_12_5').val($('#input_2_2_5').val());
    };
    });
    });

    Posted 10 years ago on Monday June 24, 2013 | Permalink
  9. David Peralty

    It would go before your </head> tag in your header.php file.

    Posted 10 years ago on Monday June 24, 2013 | Permalink

This topic has been resolved and has been closed to new replies.