Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro conditional select menu

Viewing 5 posts - 1 through 5 (of 5 total)
  • dann hanks
    #105865

    Hi,
    I have 2 select fields in my search form:

    1) Region
    2) Department

    … the department depends on the region. So for example, if in region ‘worcestershire’ is selected, then department needs to only list the departments in that region rather than displaying the full list.

    I have nearly solved this issue by using jQuery. I am using:

    jQuery('.sf-field-post-meta-region .sf-input-select').change(function(){    
        if(jQuery(this).val() == "1"){
            jQuery('.sf-field-post-meta-department').fadeIn();
        }
        else{
            jQuery('.sf-field-post-meta-department').hide();
        }
    
    	
    	});

    … so if the value is ‘1’ in the .sf-field-post-meta-region > .sf-input-select field, then display .sf-field-post-meta-department .

    I was going to create all the dropdowns for departments manually so if ‘1’ show .sf-field-post-meta-department, if ‘2’ show .sf-field-post-meta-department-othername etc etc…

    the only issue with this method is there is no way to add a unique class to the field making it impossible for jQuery to ‘select’ the class I want to show/ hide.

    Is there a way to do add custom classes to my meta select fields or perhaps a different method to achieve what I am after?

    Thanks!!

    Trevor Moderator
    #105886

    I understand what you are seeking to achieve. In part, it can be done with the current plugin.

    Before you select a county, all towns would show, but as soon as you select a county, only towns in that county would show (as an example). If you are happy with this, then ….

    In the General Settings, make sure the two Auto Count settings are ON (by default they are off).

    In the form UI fields for County and Town, make sure Hide Empty is on.

    Further options and flexibility will arrive in the next major release (V3), which we are working on right now, but is yet some months away.

    dann hanks
    #106436

    Hi Trevor, thanks for this… how would the county know which towns belong to it?

    Trevor Moderator
    #106438

    The links, if one can call them that, are made in the posts. When you select a Country and a Town in a post, our cache then assumes that town belongs (not always/necessarily exclusively) to that Country. That does rely on your user getting it right in the posts.

    dann hanks
    #106446

    ah! yes – it would do!

    thanks Trevor!

    : )

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘conditional select menu’ is closed to new replies.