CC-2986: Long show description causes Add Show or Edit Show to fail silently

Added StringLength validators for the UI fields. This way when user gave more than what
they should gave as the input, it's going to display an error msg.

The maximum length for the fields is queried from the database before the
fields were initialized.
This commit is contained in:
Yuchen Wang 2011-10-24 13:27:53 -04:00
parent 6d15308e1d
commit a65fb97aec
2 changed files with 26 additions and 7 deletions

View file

@ -1338,4 +1338,19 @@ class Application_Model_Show {
return $CC_DBC->GetAll($sql);
}
public static function GetMaxLengths() {
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT column_name, character_maximum_length FROM information_schema.columns"
." WHERE table_name = 'cc_show' AND character_maximum_length > 0";
$result = $CC_DBC->GetAll($sql);
// store result into assoc array
$assocArray = array();
foreach($result as $row) {
$assocArray[$row['column_name']] = $row['character_maximum_length'];
}
return $assocArray;
}
}