Richter12x2 Posted November 16, 2006 Posted November 16, 2006 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; } Quote
Recommended Posts
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.