Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Lost the check_form() code inclusion


Code_Grunt

Recommended Posts

Hello all,

 

The code which inserts java into the head is no longer called.

The older source which worked was the original multi-page

checkout version of Osc. The newer version which I've been

reducing down to a one page checkout now longer includes

the javascript which was used to validate the cc_number before the

posting to the server.

 

Because this is so greatly different from the original source,

I've lost which page and what call performed the insertion /

inclusion of this javascript. If someone could locate this call

and provide the details as to which file called it, and how Osc

handled the inclusion, that would be great.

 

The following is a sample of what was found the browser's

source(view source):

 

<script language="javascript"><!-- 
function check_form() {
 var error = 0;
 var error_message = "Errors have occured during the process of your form.\n\nPlease make the following corrections:\n\n";
 var payment_value = null;
 if (document.checkout_payment.payment.length) {
for (var i=0; i<document.checkout_payment.payment.length; i++) {
  if (document.checkout_payment.payment[i].checked) {
	payment_value = document.checkout_payment.payment[i].value;
  }
}
 } else if (document.checkout_payment.payment.checked) {
payment_value = document.checkout_payment.payment.value;
 } else if (document.checkout_payment.payment.value) {
payment_value = document.checkout_payment.payment.value;
 }

 if (payment_value == "cc") {
var cc_owner = document.checkout_payment.cc_owner.value;
var cc_number = document.checkout_payment.cc_number.value;
if (cc_owner == "" || cc_owner.length < 3) {
  error_message = error_message + "* The owner's name of the credit card must be at least 3 characters.\n";
  error = 1;
}
if (cc_number == "" || cc_number.length < 16) {
  error_message = error_message + "* The credit card number must be at least 16 characters.\n";
  error = 1;
}
 }
 if (payment_value == "viaklix") {
var cc_owner = document.checkout_payment.viaklix_cc_owner.value;
var cc_number = document.checkout_payment.viaklix_cc_number.value;
var cvv_number = document.checkout_payment.viaklix_cvv_number.value;
if (cc_owner == "" || cc_owner.length < 3) {
  error_message = error_message + "* The owner's name of the credit card must be at least 3 characters.\n";
  error = 1;
}
if (cc_number == "" || cc_number.length < 16) {
  error_message = error_message + "* The credit card number must be at least 16 characters.\n";
  error = 1;
}
if (cvv_number == "" || cvv_number.length < CVV_NUMBER_MIN_LENGTH) {
  error_message = error_message + "MODULE_PAYMENT_VIAKLIX_TEXT_JS_CVV_NUMBER";
  error = 1;
}
if (cvv_number.length > CVV_NUMBER_MAX_LENGTH) {
  error_message = error_message + "MODULE_PAYMENT_VIAKLIX_TEXT_JS_MAX_CVV_NUMBER";
  error = 1;
}
 }

 if (payment_value == null) {
error_message = error_message + "* Please select a payment method for your order.\n";
error = 1;
 }

 if (error == 1) {
alert(error_message);
return false;
 } else {
return true;
 }
}
//--></script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...