Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jvo33

    (@jvo33)

    Here is the full script.js, but note that I had to change a lot of the jQuery references because I changed the HTML/CSS of the form somewhat. So those changes aren’t really relevant. Just look for the “.off(‘click’) line.

    /* Donate Plugin Scripts */
    ( function( $ ) {
        $( document ).ready( function() {
            $( '.dntplgn_monthly_other_sum' ).hide();
            $( '.dntplgn_donate_monthly input[ name="a3" ]' ).click( function() {
                if ( $( this ).parent( '.jvlevel' ).find( '#fourth_button' ).attr( 'checked' ) ) {
                    $( this ).parent( '.jvlevel' ).children( '.dntplgn_monthly_other_sum' ).addClass( 'checked' );
                    $( this ).parents( '.dntplgn_donate_monthly' ).find( '.dntplgn_submit_button' ).click( function() {
                        $( this ).parents( '.dntplgn_donate_monthly' ).find( 'input[ name="a3" ]' ).val( $( this ).parents( '.dntplgn_donate_monthly' ).find( '.dntplgn_monthly_other_sum' ).val() );
                    });
                } else {
                    $( this ).parents( '.dntplgn_donate_monthly' ).find( '.dntplgn_monthly_other_sum' ).removeClass( 'checked' );
                    $( this ).parents( '.dntplgn_donate_monthly' ).find( '.dntplgn_monthly_other_sum' ).val( '' );
                    $( this ).parents( '.dntplgn_donate_monthly' ).find( '.dntplgn_submit_button' ).off('click');
                }
            });
            $( '.dntplgn_form_wrapper' ).tabs();
        });
    })(jQuery);
    Thread Starter jvo33

    (@jvo33)

    Here’s the shortode:
    [dntplgn recurring_amt1="35.00" recurring_amt2="50.00" recurring_amt3="100.00" item_name="Center Membership" paypal_email="[email protected]"]

    I think I found the problem in the meantime. When the “Other” radio button is selected, a “click” function is added to the “Submit” button. That click function sets a3 to the value of the “dntplgn_monthly_other_sum” text box. However, when you switch back to one of the preset amount radio buttons, that click function wasn’t being removed. So when you clicked Submit, it was trying to a3 to a null amount. So I added the follow to the end of the “else” block in script.js:

    $( this ).parent( '.dntplgn_donate_monthly' ).children( '.dntplgn_submit_button' ).off('click');

    • This reply was modified 8 years, 5 months ago by jvo33.
Viewing 2 replies - 1 through 2 (of 2 total)