| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,29 +89,33 @@ Button stored on PayPal will have hosted button id. Add `data-hosted_button_id` | |||
| 89 | 89 | ## Optional fields | |
| 90 | 90 | Creating custom dropdown field is by adding | |
| 91 | 91 | ||
| 92 | - `data-OPTIONnNAME` | ||
| 93 | - 'data-L_OPTIONnSELECTx` | ||
| 94 | - `data-L_OPTIONnPRICEx` | ||
| 92 | + `data-optionNname` | ||
| 93 | + 'data-optionNselectX` | ||
| 94 | + `data-optionNpriceX` | ||
| 95 | 95 | ||
| 96 | - `data-OPTIONnREQUIRED="true"` | ||
| 97 | - `data-OPTIONnPATTERN="alphaNumericRegex|alphaRegex|numericRegex"` | ||
| 96 | + `data-optionNrequired="true"` | ||
| 97 | + `data-optionNpattern="alphaNumericRegex|alphaRegex|numericRegex"` | ||
| 98 | 98 | ||
| 99 | 99 | **Dropdown field** | |
| 100 | 100 | ||
| 101 | 101 | Ex: | |
| 102 | - data-OPTION0NAME="Color" | ||
| 103 | - data-L_OPTION0SELECT0="Red" | ||
| 104 | - data-L_OPTION0SELECT1="Blue" | ||
| 105 | - data-L_OPTION0SELECT2="Green" | ||
| 106 | - data-L_OPTION0PRICE0="10.00" | ||
| 107 | - data-L_OPTION0PRICE1="8.00" | ||
| 108 | - data-L_OPTION0PRICE2="12.00" | ||
| 109 | - | ||
| 110 | - data-OPTION1NAME="Size" | ||
| 111 | - data-L_OPTION1SELECT0="Small" | ||
| 112 | - data-L_OPTION1SELECT1="Large" | ||
| 113 | - data-OPTION2REQUIRED="true" | ||
| 114 | - data-OPTION2PATTERN="alphaNumericRegex" | ||
| 102 | + data-option0name="Color" | ||
| 103 | + data-option0select0="Red" | ||
| 104 | + data-option0select1="Blue" | ||
| 105 | + data-option0select2="Green" | ||
| 106 | + data-option0price0="10.00" | ||
| 107 | + data-option0price1="8.00" | ||
| 108 | + data-option0price2="12.00" | ||
| 109 | + | ||
| 110 | + data-option1name="Size" | ||
| 111 | + data-option1select0="Small" | ||
| 112 | + data-option1select1="Medium" | ||
| 113 | + data-option1select2="Large" | ||
| 114 | + | ||
| 115 | + data-option2name="Coupon Number" | ||
| 116 | + data-option2select0="" | ||
| 117 | + data-option2required="true" | ||
| 118 | + data-option2pattern="alphaNumericRegex" | ||
| 115 | 119 | ||
| 116 | 120 | ## Callback notification | |
| 117 | 121 | On completion of a transaction you can get a payment notification ([IPN](https://www.x.com/developers/paypal/documentation-tools/ipn/integration-guide/IPNIntro)) on a callback URL you specify using the `data-callback` attribute. An [IPN simulator](https://developer.paypal.com/webapps/developer/applications/ipn_simulator) is available on the sandbox. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -352,12 +352,19 @@ PAYPAL.apps = PAYPAL.apps || {}; | |||
| 352 | 352 | btn.appendChild(document.createTextNode(btnText)); | |
| 353 | 353 | form.appendChild(btn); | |
| 354 | 354 | ||
| 355 | - form.addEventListener('submit', function (e) { | ||
| 356 | - e.preventDefault(); | ||
| 357 | - if (validateFields(form.querySelectorAll('input[type=text]'), form.querySelectorAll('div[id=errorBox]')[0])) { | ||
| 358 | - form.submit(); | ||
| 359 | - } | ||
| 360 | - }, false); | ||
| 355 | + if (window.addEventListener) { | ||
| 356 | + form.addEventListener('submit', function (e) { | ||
| 357 | + e.preventDefault(); | ||
| 358 | + if (validateFields(form.querySelectorAll('input[type=text]'), form.querySelectorAll('div[id=errorBox]')[0])) { | ||
| 359 | + form.submit(); | ||
| 360 | + } | ||
| 361 | + }, false); | ||
| 362 | + //For IE 8 | ||
| 363 | + } else { | ||
| 364 | + form.attachEvent('onsubmit', function () { | ||
| 365 | + return validateFields(form.querySelectorAll('input[type=text]'), form.querySelectorAll('div[id=errorBox]')[0]); | ||
| 366 | + }); | ||
| 367 | + } | ||
| 361 | 368 | ||
| 362 | 369 | // If the Mini Cart is present then register the form | |
| 363 | 370 | if ((MiniCart = PAYPAL.apps.MiniCart) && data.items.cmd.value === '_cart') { | |
@@ -409,8 +416,11 @@ PAYPAL.apps = PAYPAL.apps || {}; | |||
| 409 | 416 | ||
| 410 | 417 | fieldLabel = field.getAttribute('data-label'); | |
| 411 | 418 | patternName = field.getAttribute('data-pattern'); | |
| 412 | - field.value = field.value.trim(); | ||
| 413 | - if (field.getAttribute('data-required') && field.value.trim() === '') { | ||
| 419 | + //Trim not supported in IE8 | ||
| 420 | + if (field.value.trim) { | ||
| 421 | + field.value = field.value.trim(); | ||
| 422 | + } | ||
| 423 | + if (field.getAttribute('data-required') && field.value === '') { | ||
| 414 | 424 | errors.push(validateFieldHandlers.required.message.replace('%s', fieldLabel)); | |
| 415 | 425 | addClass(field, 'field-error'); | |
| 416 | 426 | } else if (field.getAttribute('data-pattern') && validateFieldHandlers[patternName] && !checkPattern(field, patternName)) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments