• Hello Everyone,

    I have been working on this for quite sometime. I would like to allow the user to select different value for payment to Paypal, but unfortunately this is not working. I have a lot of doubt about the state “jQuery(‘#PRICE_FIELD’).PRICE_FIELD(‘option’).is(‘selected’).val()+'” is working. Can anyone please help me out here.

    Contact form
    <div style=”float: left; width: 30%; text-align: left”>
    <p>Type of Membership
    [select* MemType 15/40 id:PRICE_FIELD tabindex:12 include_blank “Adult $10/- per year|10” “Child (Age 13 and under) $5/- per year|5”]</p>
    </div>

    Additional Settings
    on_sent_ok: ” if (document.getElementById(‘chessrating’).value> 2200) {location.replace(‘http://www.greensborochess.org/thank-you-for-your-participation/&#8217;)} else {location = ‘https://www.sandbox.paypal.com/?cmd=_xclick&business=greensborochessclub@gmail.com&currency_code=USD&amount=’+jQuery(‘#PRICE_FIELD&#8217;).PRICE_FIELD(‘option’).is(‘selected’).val()+’&return=http://www.greensborochess.org/thank-you/&rm=2&cancel_return=http://www.greensborochess.org/gcc-open-tournament-cancellation/&item_name=GCC Membership&address1=’+jQuery(‘#add’).val()+’&city=’+jQuery(‘#city’).val()+’&zip=’+jQuery(‘#zipc’).val()+’ &email=’+jQuery(‘#email’).val()+’&first_name=’+jQuery(‘#fname’).val()+’&last_name=’+jQuery(‘#lname’).val()+’&state=’+jQuery(‘#state’).val()+”;} “

    Many Thanks
    Jacob

    https://wordpress.org/plugins/contact-form-7/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter johnja1

    (@johnja1)

    Hey Rene,

    Can you advice me on this problems as well.

    Thanks
    Jacob

    Write a test script to make sure that the variables are not undefined:

    on_sent_ok: “alert (‘mail=’+jQuery(‘#mail’).val());”

    Put the complete paypal into the alert function to check if all variables are returned.

    Make sure that you deliver the specific id of a class when you select them:

    E.g. for mail [email* your-email id:mail]

    Hey Jacob i ve found a solution for you. Not very elegant but it works and i tested with checkboxes:

    1. First create the form with cf7 editor
    2. Load the contactform on your website and copy the HTML input checkboxes you need.
    3. Paste the HTML code snippet into the cf7 editor in place where you like to have the price checkboxes. (Delete the coresponding cf7 shortcode) So the CF7 engine is used
    4. Put a unique id in every HTML input field, e.g.

    <input name="purchaseprice[]" id="price1" type="checkbox" value="9.99"> <span class="wpcf7-list-item-label">9.99</span></span><span class="wpcf7-list-item last"><input name="purchaseprice[]" id="price2" type="checkbox" value="8.88"> <span class="wpcf7-list-item-label">8.88</span></span></span></span>

    Create a function that adds the checked attribute to selected checkbox:
    (make sure only one checkbox is activated, have to use . toogle() or similar instead of the sample code.)

    jQuery( "#price1" ).on( "click", function() {
      jQuery( "#price1" ).attr( "checked", true );
    });
    jQuery( "#price2" ).on( "click", function() {
      jQuery( "#price2" ).attr( "checked", true );
    });

    Additional settings:
    Use the following code to see how you are now able to get values of desired checkboxes:

    on_sent_ok: "if (jQuery('#price4').is(':checked')) { alert(jQuery('#price1').val()); } if (jQuery('#price1').is(':checked')){alert (jQuery('#price1').val()); }"

    Thread Starter johnja1

    (@johnja1)

    Hey Rene,

    First of all thank you very much for your help. I’m going to take your advice and try it out. In my form I use Select option (pull down menu) I was wondering if the “type” can be converted into “select” instead of “checked” Sorry to say I’m not so good at this that is the reasonI’m struggling.

    Thanks
    Jacob

    just switch the wording ‘checked’ into select;-) this should do the job as well.

    Thread Starter johnja1

    (@johnja1)

    Hey Rene,

    I was working with your code. Unfortunately I could not get it to work. I’m going back to find out why my code could not work?. I checked with paypal and their Document really does not explain how to do it. They to use on0 option and price option. If we can get this to work I’m sure many users on the blog will use it. I can make my code to work if it is not a pull down menu. If you have some time can you please advice many thanks Rene.

    https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HF080O3

    Best regards
    Jacob

    [Moderator Note: No bumping, thank you.]

    I dont get it, I am to new to this , I would like to do this with radio buttons

    any help will be grateful thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘on_sent_ok Addition Setting (using Select Option)’ is closed to new replies.