0

I need an image field with only 2 field limit. I need to call first one front and second one back and be separated.(no problem I can do that with hook_form_alter)

My problem is that in drupal 7, in adding the content, it doesn't show the second field upload button until you upload the first one. You have to add the first file, than click on "add another" to be able to upload second file and after uploading both if you delete the first one, the second one goes to first one place, which I don't want that to happen!

I know I can make two separate fields call one front image and one back, but I want to know if there is an approach to do this with only one field. (save a database table)

Thank You

5
  • Could you please specify your use case for "after uploading both if you delete the first one, the second one goes to first one place, which I don't want that to happen!". May be someone could find a work-around for that problem such that drupal's default file upload behaviour might not cause a problem for you.
    – SGhosh
    Commented Jan 28, 2013 at 7:25
  • My use case: I will use this field for business card printing, the client will upload the front image and back image, If after uploading his pictures he decided to delete the front image and update it with new one, the back image will take place of front image, which will confuse the person, and may make possible problems. Thank you for your interest in my question, appreciate it. Commented Jan 28, 2013 at 7:44
  • In drupal 6, multi-value field weren't like this, so I think there should be an easy solution to bring the same functionality back, but want to make sure to don't make a wrong approach. Commented Jan 28, 2013 at 7:50
  • Could you have 2 different fields for the 2 different purposes, each being single valued?
    – SGhosh
    Commented Jan 28, 2013 at 8:35
  • As I mentioned I need to know if it is possible to achieve this with only one field, It seems to me that there should be an easy approach to this, because drupal 6 was like that. Thanks for suggestion. Commented Jan 28, 2013 at 16:38

1 Answer 1

0

Just use the single image field, add field description text for the user in regards to clicking to "add another" item when uploading the two images.

On updating, the user can adjust the weight of the images and drag/drop the front/back images into order.

Alternatively, you could look at using two fields, or a module like field_collection

2
  • For some reasons I don't want to use field_collection and two separate field. One of the reason is that it will add extra and unnecessary table, second because I need visitors to be able to edit the field inside a view, so if I put two different field there will be two save button, and currently there are some problems with saving the whole node with ajax using edit-field option in view, so I think more easier option would be to just accomplish this using one field. Commented Jan 28, 2013 at 8:06
  • The drag and drop option will increase the chance of mistake, and we don't want that to happen. Any way thanks for your suggestion @DavidThomas Commented Jan 28, 2013 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.