We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Syntax for checking if a single grid field has content

How Do I?

Mandarax's avatar
Mandarax
21 posts
8 years ago
Mandarax's avatar Mandarax

So for this project I need to check if a grid field subfield (?) has content and then output code based on the results. There are 3 subfields within this single-row grid field and and I only one to check against one of them for content

Here’s my ham-fisted way of displaying what I would like to happen but any pointers on how to structure that properly would be appreciated.

{mygridfield}

{if mygridfield:text}

Yes there's stuff in here

{if:else}

Nothing to see here

{/if}

{/mygridfield}

Thanks.

       
Rob Allen's avatar
Rob Allen
2,950 posts
8 years ago
Rob Allen's avatar Rob Allen

That syntax should work, have the same running on site I’m building right now.

Have you tested it? Does it work?

       
Mandarax's avatar
Mandarax
21 posts
8 years ago
Mandarax's avatar Mandarax
Thanks Rob - for having more faith in me that I did!

)

It does indeed work.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.