• Hello. So I’m using the pipe character to add a value to a select menu so that the value is different than the option name. Like:

    “billions|5000” and so on.

    I am using the Additional Settings block for a bit of jQuery that will grab the value of the selected item and attach it to a post to PayPal. There’s a post on how to do this somewhere, which I have followed.

    I also write out the value of the item to my console so I can see what it is.

    So lines like this:

    on_sent_ok: ” itm_val = jQuery(‘#ggpTicket’).val();”
    on_sent_ok: “console.log(itm_val);”
    on_sent_ok: “location = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XXXXXXXXXXXX&amount=’ +itm_val;”

    Are the lines that are supposed to append the ticket amount to the query string. However, if my option/value pair is “billions|5000” my console tells me that “billions” is the value being passed and paypay, of course, tells me I’ve used an incorrectly formatted amount.

    Since the view on the front end shows “billions” as both the name and the value, at what point is the value “5000” so I can grab it and pass it to paypal properly?

    It’s beyond me why the default of checkboxes, radio buttons and select menus is to use the name AS the value. I have never created such a form in my life. The default should be to give the item a name AND give it a value.

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

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Select option name instead of value grabbed by jquery to append to query string’ is closed to new replies.