Title: Validation Error
Last modified: May 22, 2019

---

# Validation Error

 *  Resolved [andrewperry](https://wordpress.org/support/users/andrewperry/)
 * (@andrewperry)
 * [7 years ago](https://wordpress.org/support/topic/validation-error-69/)
 * Having the same issue with validation / checked payment type when different payment
   methods are enabled much like this ticket [https://wordpress.org/support/topic/validation-error-when-paypal-also-enabled/](https://wordpress.org/support/topic/validation-error-when-paypal-also-enabled/)
 * However I am using cash on delivery as a method as well as secure trading, the
   error is ‘invalid card type’ when on checkout and paying by cash on delivery 
   the order will still go through. There are no issues with payment for the card
   payments / Secure trading.
 * The ticket above suggests fixing by editing line 58 of /secure-trading-gateway-
   for-woocommerce/assets/frontend/js/main.js
 * if((‘.payment_method_st_gateway’).is( ‘:checked’ )) {
 * and a closing brace to line 75
 * }
 * However the plugin has updated since then and not sure where to add this code,
   would anyone be able to help?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fvalidation-error-69%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [7 years ago](https://wordpress.org/support/topic/validation-error-69/#post-11559259)
 * Looks like its missing the $ from the class selector in the jQuery.
 *     ```
       if($(‘.payment_method_st_gateway’).is( ‘:checked’ )) {
   
       and a closing brace to line 75
   
       }
       ```
   
 * We gave up on this plugin after a while.
    hope that helps.
 *  [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [7 years ago](https://wordpress.org/support/topic/validation-error-69/#post-11559264)
 * Also use ‘ quotes not ‘ and ’
 *  Thread Starter [andrewperry](https://wordpress.org/support/users/andrewperry/)
 * (@andrewperry)
 * [7 years ago](https://wordpress.org/support/topic/validation-error-69/#post-11559268)
 * Yea I’m just not sure exactly where to place this condition with the validation
   like the ticket above, I see the plugin is retired from WooCommerce and just 
   through a 3rd party now.
 * Thanks,
    Andrew
 *  [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [7 years ago](https://wordpress.org/support/topic/validation-error-69/#post-11559360)
 * You might need an onchange or onsubmit event to wrap around this, however have
   a look and see if there are any hooks or JS hooks regarding WooCommerce or the
   plugin has any specific.
 * [https://docs.woocommerce.com/wc-apidocs/class-WC_Checkout.html](https://docs.woocommerce.com/wc-apidocs/class-WC_Checkout.html)
   
   [https://docs.woocommerce.com/document/composite-products/composite-products-js-api-reference/](https://docs.woocommerce.com/document/composite-products/composite-products-js-api-reference/)
 * Something like an php hook to send back to php and return a value to process 
   the js from submitting the form or in the js itself might have a function.
 * I know Ninja Forms uses Backbone and Marionette listeners for the forms so you
   can interrupt processing there.
 * I remember having to hack the plugin itself because the JS added extra digits
   to the year. In assets/js/front-end/main.js (note you will need to re minify 
   this.
 * You will find lines like this line 81 – 95
    Here is my version that fixes the
   checkout error on the date
 *     ```
       $(document).on('change, keyup', '#' + st_object.id + '-card-expiry', function () {
       		if ($(this).val().indexOf('/')) {
       			///var date_details = $(this).val().split(' / ');
       			var date_details = $(this).val().toString().split('/');
   
       			if(date_details.length > 1) {				
       				/// 29.01.2019 - Fixed
       				$('#' + st_object.id + '-cc-month').val( date_details[0].trim() );
       				///$('#' + st_object.id + '-cc-year').val( "20" + date_details[1] );
   
       				$('#' + st_object.id + '-cc-year').val( date_details[1].trim() );
   
       			}
       		}
       	});
       ```
   
 *  Thread Starter [andrewperry](https://wordpress.org/support/users/andrewperry/)
 * (@andrewperry)
 * [7 years ago](https://wordpress.org/support/topic/validation-error-69/#post-11560774)
 * I fixed by adding if($(‘.payment_method_st_gateway’).is( ‘:checked’ )) {
 * }
 * wrapped around all the callback functions, this plugin does not play nicely with
   multiple payment methods, please fix in a future update!
 *  [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [7 years ago](https://wordpress.org/support/topic/validation-error-69/#post-11560791)
 * Nice one!
 * I’m sure the developers will get to look at this post and find a fix in due course.
 * Thanks
 * Andi

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Validation Error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/secure-trading-gateway-for-woocommerce_d4adba.
   svg)
 * [Trust Payments Gateway for WooCommerce](https://wordpress.org/plugins/secure-trading-gateway-for-woocommerce/)
 * [Support Threads](https://wordpress.org/support/plugin/secure-trading-gateway-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/secure-trading-gateway-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/secure-trading-gateway-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/secure-trading-gateway-for-woocommerce/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/validation-error-69/#post-11560791)
 * Status: resolved