|
 Manuel Lemos - 2007-06-26 07:20:41 - In reply to message 9 from Brian Read
Failing means the Validate function will return the error message associated to the invalid field. The script does not exit. You just need to process somehow the error returned by the Validate function. Usually you display the form again exhibiting the error message to the user.
 Brian Read - 2007-06-26 08:28:10 - In reply to message 11 from Manuel Lemos
Yes, but i am concerned about the $form->Changes['loadinput'] call in the Validation function - it always returns "false" irrespective of whether the field has been changed or not.
 Manuel Lemos - 2007-06-26 08:45:50 - In reply to message 12 from Brian Read
That can only be because the value actually changed unlike you expect. Try adding this command in your validation function to see what value the input value was before and after calling LoadInputValues.
var_dump($form->Changes['loadinput'], $form->GetInputValue('loadinput'));
That should telling you why it is not working as you expect.
 Brian Read - 2007-06-28 09:50:59 - In reply to message 13 from Manuel Lemos
ok, got that sorted.
..but (finally I hope), when the validation fails I am not getting the "ValidationFunctionServerErrorMessage" out, although I am getting the field highlighted etc. I do get the relevant error message when validation fails for any of the other fields.
 Manuel Lemos - 2007-06-28 13:07:56 - In reply to message 14 from Brian Read
Are you sure you are using ValidationFunctionServerErrorMessage and not ValidateFunctionServerErrorMessage ?
 Brian Read - 2007-06-28 17:05:57 - In reply to message 15 from Manuel Lemos
yes:
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"loginname",
"ID"=>"loginname",
"MAXLENGTH"=>50,
"LABEL"=>"User Name",
"ACCESSKEY"=>"F",
"VALUE"=>$userdata['loginname'],
"ValidationServerFunction"=>"CheckUsernameUnique",
"ValidationServerFunctionErrorMessage"=>"User Name not unique - suggest you use your full email address?",
# "ValidationErrorMessage"=>"User Name not unique - suggest you use your full email address?",
"SIZE"=>50
));
as you can see I tried the generic one as well.
 Brian Read - 2007-07-12 09:13:13 - In reply to message 16 from Brian Read
Still not fixed this - i have moved on, but will need to get it fixed before going live. I guess it must be something silly and obvious!
 Manuel Lemos - 2007-07-12 13:47:48 - In reply to message 17 from Brian Read
Did you use the var_dump() call that I suggested before? What did it output?
 Brian Read - 2007-07-12 18:52:18 - In reply to message 18 from Manuel Lemos
I fixed the problem of the validation proc being invoked, I just have the problem that the validation error message is not displayed, despite the validation failing and the offending field being highlighted.
A thought - i am using Php4 - I have just looked at the cal plugin and realised it needs php5. Could this be the problem?
 Manuel Lemos - 2007-07-12 22:40:30 - In reply to message 19 from Brian Read
It depends on what you mean the validation is not being displayed.
The forms class itself does not display any validation errors. The Validate function returns an error message when a validation condition fails. However is up to you to use that error mesage value and display it to the user.
|