I have a custom order form that does everything okay except when one of the required fields is not entered and the validation kicks in, I lose the values from all the other fields. My form fields are created like so:
new TextField('Company','Company'),
new TextField('Contact', 'Contact'),
new TextareaField('Company_Address', 'Company Address'),
And the form is constructed the following way:
$requiredFields[] = 'Company';
$actions = new FieldSet(new FormAction('processOrder', _t('OrderForm.PROCESSORDER','Place order')));
$validator = new OrderForm_Validator($requiredFields);
$validator->setJavascriptValidationHandler("prototype");
parent::__construct($controller, $name, $fields, $actions, $validator);
if($this->extend('updateFields', $fields) !== null) {$this->setFields($fields);}
if($this->extend('updateActions', $actions) !== null) {$this->setActions($actions);}
if($this->extend('updateValidator', $validator) !== null) {$this->setValidator($validator);}
I have tried removing the lines from the form action script that clears the session data, but that has not helped.
It seems that the javascript validation does not actually kick in and it gets validated server side, but not sure how to make the javascript validation kick in.
Any help would be great!