Hi all!

   I got two questions about validating form data. The first one might be
the simplest. I've got a regular expression which checks if an e-mail
address is correct:

new
Zend_Validate_Regex("/^$|^[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*@(([a-z]([-a-z0-9]*[a-z0-9]+)?){1,63}\.)+([a-z]([-a-z0-9]*[a-z0-9]+)?){2,63}$/")

I've added the / at the beginning and end because other expressions wouldn't
work without it. This expression works when I use it in "ereg" for example.
I now get the error: "Internal error matching pattern {the pattern}". Does
anyone know what I'm doing wrong, or what would be a good expression (but I
don't want to make this a script request!).

The second question is about fields that get a <br /> when the value was not
right regarding the validator. I do something like:

// Apply the filter to the post data.
$oFilter = new Zend_Filter_Input($aFilters, $aValidators,
$this->_request->getPost(), $aOptions);

// Save the data in the class var (escaped / html removed).
$this->_aCheckedData['relation'] = $oFilter->getEscaped();

When there are errors I show the form again. I try to print the data again
(the data I put in _aCheckedData['relation'] here), and now the field that
was not correct, contains "<br />", in stead of the value the user filled
in.

What could I be doing wrong here? If you need more information, please ask.

Thanks!
-- 
View this message in context: 
http://www.nabble.com/E-mail-regular-expression-and-empty-fields.-tf4435743s16154.html#a12654897
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to