Hello there,
i am currently struggeling with a custom made Snippet to custom-validate a value from a Form-It Form.
I need to validate if the serial no entered has a correct syntax.
I must admit that I am more a designer than a programmer.
My form:
[[!FormIt?
&hooks=`spam,email,redirect`
&emailTpl=`sentEmailTpl`
&emailSubject=`[[+datestamp_submitted]] | [[+contact_subject]]`
&emailTo=`[email protected]`
&emailCC=`[email protected]`
&customValidators=`serialno`
&validate=`snno:serialno`
&redirectTo=`4`
]]
My serialno-snippet:
<?php
$valuein=$mcsnno;
$date=$valuein{4};
if($date===x xor $date===y){
return true;
}else{
$errorMsg = 'Wrong!';
$validator->addError('mcsnno',$errorMsg);
return false;
}
My problem now is:
When running a .php file of the snippet on the same server it perfectly works.
When running the snippet, it always returns the error Msg.
Who can help?
What do I do wrong?
Many thanks in advance.
BR
Aviator