I have number of values set to unlimited, but when I go to create story I have 2 upload sections and under them [Add another item]. 99% of the time my users will only be putting in one picture so I would like to show just one upload section, with another only appearing IF the [Add another item] is clicked. I am trying to make the create content form as simple for my users as possible - can you advise please. I attache a visual for clarity

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Project: ImageField » FileField
Version: 6.x-3.0-alpha4 » 6.x-3.x-dev
Category: support » feature

I agree that this is definitely a usability problem. The "two default fields" is actually caused by CCK, which has this behavior for all multiple value fields. But I definitely agree that we should only show one upload field at a time, especially since uploading two files at once can cause problems.

This is actually a problem caused by FileField which provides the default field used by ImageField, so I'm moving this issue over there.

artatac’s picture

Thanks for the prompt response

quicksketch’s picture

Status: Active » Postponed

Turns out this is already fixed in CCK in the #196421: Deleting unwanted multiple values / multiple values delta issues patch. I think we'll be best off to just wait for that issue to complete.

quicksketch’s picture

Status: Postponed » Fixed
FileSize
22.54 KB

Oh nope, turns out I fixed this accidentally in #397578: Uncouple ImageField from FileField Custom Hooks. Though I'm not entirely sure how. See the screenshot, both fields are unlimited value fields.

quicksketch’s picture

Title: reduce standard 2 upload sections to 1 » Reduce standard 2 upload sections to 1 when "Unlimited" number of values
Status: Fixed » Postponed

Well this seems to effect ImageFields but not FileFields. I'm putting this back to postponed until I can figure out where this is coming from.

quicksketch’s picture

Status: Postponed » Fixed
FileSize
1.96 KB

Alright, I finally found a way to ensure FileField starts with exactly one upload field in all cases. CCK checks the $form_state['item_count'] variable for every field and then bases the number of fields based on that value (if it exists), then adding 1. So by setting this value to 0, we can ensure that CCK only adds one field every time.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

artatac’s picture

Thank you - will this be incorporated within the standard (current module) or remain as a patch to be applied?

DeFr’s picture

For the record, this conflicts with the latest CCK 6.x-3 development branch where #196421: Deleting unwanted multiple values / multiple values delta issues was fixed: with the patch, there's exactly as many upload fields as the default item_count, which means that there's now 0 upload field by default.

weynhamz’s picture

Why Shall We make it default to 1???
in Version 3 development ,if it set to 0,there case an php error warning.......

c_s_c’s picture

Hello everyone.

It seems to concern more than Imagefields or Filefields. I encounter the same difficulty with 'unlimited' location fields (from Location and GMap modules).
I am using Location 6.x-3.1-rc1 with Location CCK activated.

How can this be corrected ? What functions are acting wrong ?

plazma’s picture

FileSize
96.55 KB

Hi all,
I still seem to be having this issue, only happens on a multistep form though from what i can see is that all patches have been applied but still displaying 2, its a weird one, quite annoying also

jrz’s picture

Hi plazma,

did you end up finding a solution to you problem?

dave_______1’s picture

He everyone,

Did anyone find a fix for this?

Dave.