Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by  pouyanz 1 month ago.

  • Author
    Posts
  • #9464

    pouyanz
    Participant

    If you have a number field which has a range of 0-999999999
    and ‘required’ => true
    like so:

    ‘type’ => ‘number’,
    ‘field’ => zzz,
    ‘label’ => xxxx,
    ‘description’ => yyyy,
    ‘required’ => true,
    ‘attributes’ => array(
    ‘min’ => 0
    ,’max’ => 999999999
    )

    you would think that 0 will pass the required if statement!
    but it won’t:
    in “class-piklist-validate.php” line 656 it says
    “if (empty($required))”
    0 is also empty so you will get this validation error no matter what
    i changed it to “if (empty($required) && !is_numeric($required) )”
    and it does what i want it

You must be logged in to reply to this topic.