Viewing 7 reply threads
  • Author
    Posts
    • #3647
      jcrist
      Member

      Being able to select multiple images is great but sometimes we need to limit the file field to only 1 images/upload. I know that we can use

      ,'validate' => array(
      	  array(
      	    'type' => 'limit',
      	    'options' => array(
      	      'min' => 1,
      	      'max' => 1
      	    )
      	  )
      	)

      however this seems a bit cumbersome — if the user has a file selected and click the Add Media button, another file is added. Then when saving, they receive an error that there should only be 1 file selected.

      I see that in version 0.9.5n there was an enhancement for setting ‘multiple’ => false, however this doesn’t seem to work as (I) expected. While is does limit the number of files you’re able to select in the media upload lightbox, you’re still able to select multiple files by adding a file then clicking Add Media again. Ideally I’d like to replace the file if 1 has already been selected. Is the only option right now to create a custom field type?

    • #3653
      Steve
      Keymaster

      @jcrist– On our list of todos. We wanted to first get the server-side validation solid because it’s more secure.

    • #3720
      mcmaster
      Member

      Thanks for the explanation, Steve. This one’s on my wishlist, too.

    • #3901
      anagram
      Member

      +1

      but still i’m happy to see that there’s a workaround (could be improved though)

    • #5241
      jcrist
      Member

      Sorry to bump an old thread but is still on the todo list? 9.9 is amazing btw

    • #5253
      Steve
      Keymaster

      @jcrist– The Javascript version is. But the PHP version works beautifully and is in the Demos under the Validation tab.

    • #5260
      jcrist
      Member

      Thanks Steve, it does work well though my question is more geared toward not allowing the multiple files at all, exactly like WordPress’ Featured Image field.

      I know that it would take some re-working of the file field but I thought I would ask having to create a new field for this 🙂

    • #5264
      Steve
      Keymaster

      @jcrist– We plan on adding this feature in now that we have the server-side validation working. Right now we’re working on the next version of Piklist. Unfortunately, feature requests are going to have to wait a bit.

      • #9424
        Alex Kladov
        Participant

        @Steve Sorry to bump an old thread, didn’t want to create one, since this discussion already exists.

        Is this still in the works 4 years later? Or is there a single file select feature already available (i.e. like WordPress Featured Image field), but just not documented?

        I am not talking about back-end validation, I already use that one and it works great. Just would be a nice from UI/usability perspective to disallow multi-file selection on the front-end as well, as to not confuse the users with unnecessary errors.

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