Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Check for number in street address


iTea

Recommended Posts

People tend to forget their home number while entering their street address.

 

Added this function to form_check.js.php:

 

function check_street_address(field_name, message) {

var street_address = form.elements[field_name].value;

if (street_address.search(/[0-9]/) == -1) {

error = true;

error_message = error_message + "* " + message + "\n";

}

}

 

calling it from this line:

 

check_street_address("street_address", "<?php echo ENTRY_STREET_ADDRESS_MISSING_NUMBER_ERROR ?>");

 

and added

 

define('ENTRY_STREET_ADDRESS_MISSING_NUMBER_ERROR', 'Voer uw huisnummer in.');

 

to dutch.php and

 

define('ENTRY_STREET_ADDRESS_MISSING_NUMBER_ERROR', 'Please enter your home number.');

 

to english.php.

 

Works like a charm! However, when I switch from default Dutch to English, all of a sudden a street address without a number is acceptable. How can that be? When I switch back to Dutch again, it becomes unacceptable again, as it should. I cannot understand why this is happening. Please help!

Link to comment
Share on other sites

Have you confirmed that all your new address-checking code is in the common PHP code, and not only in the Dutch language files? Only the language string defines should be under a language-specific directory. I presume that English is working OK otherwise.

Link to comment
Share on other sites

Yep, the check is in form_check.js.php, which resides in /includes, not within a language map. That's the reason why I find this so strange.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...