Viewing 4 reply threads
  • Author
    Posts
    • #7182
      jrcreative
      Member

      I’m trying to make a field type of “file” a required field. It works fine when I do the initial file upload and a save the post, but validation stops the save on post updates.

      Here’s my code for that field.. nothing fancy.

      piklist('field', array(
        'type' => 'file'
        ,'field' => 'government_id'
        ,'label' => __('Government Issued ID')
        ,'options' => array(
          'basic' => true
          )
        ,'required' => true
      )
    • #7186
      jrcreative
      Member

      FWIW, the same behavior happens in front end forms and admin meta boxes. I tried the custom validation to check the existence of a file and got the same result. Is there a way to use a custom validation filter to address this?

    • #7216
      jrcreative
      Member

      bump…

      Has anyone come across this before? Any possible solutions I should be looking at?

    • #7230
      Steve
      Keymaster

      @jrcreative– Check out the VALIDATION tab in the Demos. We have a required file field there.

    • #7334
      jrcreative
      Member

      @Steve I just got around to looking at the file validation tab in the demos, and it’s not actually checking a file field type. It’s evaluating the contents of a text field to see if that’s a valid file.

      Can validation be done with a file field type?

      I don’t need it to validate that it’s a valid file, I would be satisfied if it validated as true if it sees a string of any kind stored in that post_meta field.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.