Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I've been working with the javascript_validation function, trying to get it to display a given message if the length of the PO number is either 0 or more than 12 places, to prevent embarassing program crashes when someone writes a novel in the PO number field, but I'm not terribly good at coding

 

I can get it to do either, but not both at the same time. Whenever I try, it ignores the entire function - what's wrong with this statement?

function javascript_validation()

{

$validation_string = 'if (payment_value == "' . $this->code . '") {' . "\n" .

' var purchase_order_number = document.checkout_payment.purchase_order_number.value;' . "\n" .

' if (purchase_order_number.length == 0) || (purchase_order_number.length >= 13) {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_PO_TEXT_JS_PO_NUMBER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

'}

' . "\n";

return $validation_string;

}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...