Hello people
I am new to SilverStripe and loving it so far, but I have run into a little problem
Title pretty much says it all but to clarify, I am trying to add validation to a custom ModelAdmin form for DataObject.
Code snippit below:
/* start */
if (!class_exists('stVehicle')) {
class stVehicle extends DataObject {
public function validate() {
$result = parent::validate();
$this->RegNum = str_replace (' ', '', strtoupper($this->RegNum) );
if ( strlen($this->RegNum) != 7 )
$result->error ('bad reg num');
return $result;
}
} // end class stVehicle
}
/* end */
This works fine when amending existing records but the system hangs when attempting to add a new record.
Stranger still, an add operation hangs regardless of whether or not the entered data passes the test.
I do not understand why this is happening or, more to the point, how to fix it.
Any suggestions would be much appropriated.
In case it is relevant, the system is running under SilverStripe 2.4.7
And before anybody suggests it, I cannot upgrade as this is a legacy site so I need a solution for 2.4.7