• I’m trying to have a button link generate a specific code into a form field when clicked, but can’t seem to find any solution that works. I know there’s got to be a Javacript answer, but none of the suggested solutions are getting it done. Can view here: https://designatwork.net/c3/checkout/

    <div class="nm-checkout-form-coupon">
            <form class="checkout_coupon" method="post" style="display:none">
                <p class="form-row">
                    <input type="text" id="coupon_code" name="coupon_code" class="input-text" placeholder="<?php _e( 'Physician Code', 'woocommerce' ); ?>" id="coupon_code" value="" required />
                </p>
                <p class="for-row">
                    <p>Don't have a Physician Code? <a href="" data-toggle="modal" data-target="#physcode">Get one here!</a></p>
                    <!-- Physician Code Modal -->
                        <div class="modal fade access-code-popup" id="physcode" tabindex="-1" role="dialog" aria-labelledby="physcodelabel" >
                      <div class="modal-dialog">
                       <div class="modal-content">
                        <div class="modal-body">
                          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                          <p>AQ Skin Pro products are available exclusively through participating clinics and physicians offices. If you do not have an Exclusive Physician Code, click "generate a code" below.</p>
                          <button class="nm-simple-add-to-cart-button single_add_to_cart_button button alt" data-dismiss="modal" aria-label="Close" onClick="fillFields('coupon_code')" alutocomplete="off">Generate a Code</button>
                          </div>
                        </div>
                       </div>
                    </div>
                </p>
                <p class="form-row">
                    <input type="submit" class="button" name="apply_coupon" value="<?php _e( 'Apply Physician Code', 'woocommerce' ); ?>" />
                </p>
            </form>
        </div>
  • The topic ‘Is there a way to autofill a form field based on a link?’ is closed to new replies.