ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

grouping entry fields so that one or the other may have data entered

April 20, 2011 10:43am

Subscribe [2]
  • #1 / Apr 20, 2011 10:43am

    ip

    80 posts

    Is there a way of grouping two fields so that when content is posted data maybe entered into one OR the other field, but not both?

  • #2 / Apr 20, 2011 10:56am

    Mark Bowen

    12637 posts

    What exactly are you after here as that sounds a little odd to me. If you only want one field filled in then why not just have the one field?

    Is this in the backend or a front-end form that you want to do this?

    Will definitely help us out if you can let us have a little more information as to what you are doing though.

    Best wishes,

    Mark

  • #3 / Apr 20, 2011 11:02am

    ip

    80 posts

    I was just editing my question when you answered actually!

    When you publish or edit an entry I want to group some fields to show they are related, an image field, alt field, description for the image, and a url.

    the idea is that you can add either an image, or a url to an online video, my original question was wrong as I thought it would be one or the other, but if you add a video, you’d want a thumb too.

  • #4 / Apr 20, 2011 12:02pm

    Mark Bowen

    12637 posts

    I think your best bet here would be to use Matrix here.

    That way you could have columns for all the information you need and as a last column have a drop-down which the user selects whether the information they have entered is for an image or a video.

    You can then style / output the information as you need by using the drop-down as a conditional in your template.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #5 / Apr 20, 2011 12:14pm

    ip

    80 posts

    Hi, thanks for answering.

    The Matrix can do what I want, but getting my current client to purchase extras is a pain, so for now I’d prefer an alternative approach.

  • #6 / Apr 20, 2011 12:19pm

    Mark Bowen

    12637 posts

    Well you could just use a load of fields forgetting Matrix and still have a drop-down to determine what it is the user is adding. Would still work in the exact same way but just wouldn’t be as nice looking.

    Best wishes,

    Mark

  • #7 / Apr 20, 2011 12:28pm

    ip

    80 posts

    The dropdown is a good idea, but you’re right, it wont be as tidy as using the Matrix option, I’ll have to indicate that fields are connected through naming, ie ‘image_1’, ‘image_1_alt_tag’, ‘image_1_url’, etc.

    Thank you.

  • #8 / Apr 20, 2011 12:48pm

    Mark Bowen

    12637 posts

    Might be worth installing something like NSM Publish Hints in this instance then in order to give the client some information as to what to fill in for each circumstance.

    Best wishes,

    Mark

  • #9 / Apr 20, 2011 1:03pm

    ip

    80 posts

    Thank you

  • #10 / Apr 20, 2011 2:06pm

    Mark Bowen

    12637 posts

    Thank you

    No problem at all. Hope you get it all working to your needs.

    Best wishes,

    Mark

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases