Zen Cart Logo
Forums / General Questions / validation / all CAPITALS alert for attributes

validation / all CAPITALS alert for attributes

Views: 465

Results 1 to 3 of 3
13 Jan 2012, 10:49 AM
#1
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

validation / all CAPITALS alert for attributes

I use my TEXT attributes, which act as the customers personalisation to be engraved on to whatever product they have selected, due to the nature of the products i cannot accept capital letters only lowercase or propercase strings.

Im looking for a way to ensure that the customer does not enter all capital letters. I also cannot use javascript to automatically force proper or lower caps as there is no way of logically seeing which words should be automatically capitalised ie names etc and which shouldnt ie simple sentences.

so i need to use validation of some kind to alert the customer that their input is in all caps and needs to be changed in order to be submitted, can anyone point me either to the correct file to edit the validation, a mod which may help or any advice in general

thanks!

14 Jan 2012, 10:05 AM
#2
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: validation / all CAPITALS alert for attributes

ok so ive been trying at this, i only know a little php to keep me going, but im not sure what im meants to be doing at all!?

ive looked in the includes/functions/functions_lookups.php file and after this section of code ```
// text required validation
if (preg_match('/^txt_/', $option)) {
$check_attributes = $db->Execute("select attributes_display_only, attributes_required from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . (int)$product_id . "' and options_id='" . (int)preg_replace('/txt_/', '', $option) . "' and options_values_id='0'");
// text cannot be blank
if ($check_attributes->fields['attributes_required'] == '1' and empty($value)){
$check_valid = false;
}
}

return $check_valid;

}


ive added ```
 //check for caps 
	if (ctype_upper($option) ==1) {
		$check_valid = false;
      }

and it didnt work :/

after looking it up (for ages lol) im really out of my depth can anyone help?

all i want is to trigger the alert system already there if the string is caps, i dont want to change i just want to let the customer know?