Forums

Server Side Validation not working of Name Having ÅÄÖ

rickystanley76 29 Jun, 2012
Hello There
We have a form and we have some validation in server side. In Swedish name we have ÅÄÖ characters, it's no problem in the frontend but when we storing the data in the DB then we have validation and it is recjecting the data which has ÅÄÖ.
Need you help and advise.
Thanks
Ricky D'Cruze
GreyHead 30 Jun, 2012
Hi Ricky,

The simplest answer is probably to use Custom Serverside validation rather than the Auto Serverside validation which only allows these characters a-z ._-

This code should work - add extra characters as needed:
<?php
$data =& $form->data['input_name'];
$regex = '/^[ÅÄÖa-z ._-]+$/i';
if ( isset($data) && $data ) {
  if ( preg_match($regex, $data) === false ) {
    $form->validation_errors['input_name'] = "Invalid data";
    return false;
  }
}
?>

Bob
This topic is locked and no more replies can be posted.