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.

JQuery or if:else

April 18, 2012 2:42pm

Subscribe [1]
  • #1 / Apr 18, 2012 2:42pm

    Mobster

    64 posts

    I’m looking to create some channel field select conditionals to hide two different weight variables.  I’m looking to wrap a series of select tags with conditional content.  If user selects bulk_option, I want to hide another.  Would jQuery be best for something like this or, could I use if:else conditionals to display or hide other options. 

    Thanks!

    {if bulk_option !=""}
    <!-- Display None -->
    {if:else}
        <div class="control-group clearfix">
        <label class="control-label">Weight</label>
         <div class="controls">
          <span class="store_product_weight"> {weight}<small>lb.</small> Bags*</span>
         </div>
        </div>
    {/if}
    
    {if bulk_option !=""}
        <div class="control-group clearfix">
        <label class="control-label">Bulk Weight</label>
         <div class="controls">
    <span class="store_product_weight"><select>
        {exp:channel:entries channel="products" limit="1" dynamic="off"}
            {bulk_product_select}
                <option value="{item}">{item}</option>
            {/bulk_product_select}
        {/exp:channel:entries}
    </select> <small>lb.</small> Box / Bulk Bag </span>
    
    
         </div>
        </div>
    {/if}
  • #2 / Apr 19, 2012 12:18pm

    Dan Decker

    7338 posts

    Hi Mobster,

    Your use case would depend on if you need the if/else to be dynamic. If you want the page to respond to user input in real time, then jQuery is the way to go. If you want ExpressionEngine to present a different set of choices based on a saved previous choice, the inline if:else will work.

    Make sense?

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases