Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Validation
  • now I am trying to validation valid string.



    when I insert japanese characters in the textbox(hotel_name),error is come out.

    I used validation code like the following:

    in controller

    $val = \Validation::forge();
    $val->add_field('hotel_name', 'hotelname', 'required|min_length[4]|max_length[32]|valid_string[alpha,numeric,dashes,utf8]');

    in view
    <div class="form-group">
                                <?php echo Form::input('hotel_name', Input::post('hotel_name'), array('class' => 'form-control')); ?>
                                <div class="form-group has-error">
                                    <label class="control-label"><?php echo Validation::instance()->error('hotel_name') ?></label>
                                </div>                            
                            </div>



    how can i insert japanese character?
  • There is nothing in your rule configuration that allows these characters, you only allow alphabetic characters [a-z][A-Z], numeric values [0-9], an underscore and a dash.

    "utf8" is a flag, and says the input is in utf8, not that it should accept any utf8 character.

    If you want to explicitly allow japanese characters, you have to use a regex. http://php.net/manual/fr/function.preg-match.php#94424 may give you some pointers.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion