Support Forum

Every time that you post a problem, PLEASE add the Joomla and the extension's versions and revisions (for example: Joomla 3.3.6, Contact Enhanced 3.3.5), PHP version and Server's Operating System. If you only manage only one site it is easier if you edit your profile and just add that information to your signature. Don't forget to add a detailed description of the problem. If possible, write down all steps to simulate the problem.

Before submitting a new post, PLEASE make sure you are running the latest version, test in different browsers (IE, FF, Chrome,..) and clear Joomla and browser's cache after every change you make.

Also, most questions are already answered in our FAQ and in iFAQ and Contact Enhanced documentation pages.

× Contact Enhanced is a contact component manager created to replace Joomla! core contacts component and add lots of advantages and new features (see Features ) and it offers many plugins and modules for several different purposes,
Product page | Documentation Page

Hidden/Revealed Fields in slelect list

1 year 11 months ago #26214 by blue_Shift
Referencing an earlier ticket, in the select list on "membership-3" the last two items should open nine fields hidden below it. I wasn't quite sure how to implement that per the documentation on hidden fields with JQuery. Suggestions?

Attachments:

Please Log in or Create an account to join the conversation.

1 year 11 months ago #26218 by support
Dear blue_Shift,

A lot has changed in Contact Enhanced for Joomla 4. I haven't updated all the documentation pages yet. I've updated the Documentation page for what you are trying to achieve. Please read this article .

I have just written and tested the Javascript on this page.

Let me know if you need any further assistance.

Best regards,

Please Log in or Create an account to join the conversation.

1 year 11 months ago #26220 by blue_Shift
Clicks: Like

Please Log in or Create an account to join the conversation.

1 year 11 months ago #26223 by blue_Shift
Further Question - there are nine hidden fields, can I group the if/else statments?
if($(this).val() == 'Other' ){
$('#ce-ff-container-21').css('display','block');
$('#ce-ff-container-22').css('display','block');

or like
$('#ce-ff-container-21').css('display','block' && '#ce-ff-container-22').css('display','block');

Or do these each need a separate if/else?

Please Log in or Create an account to join the conversation.

1 year 11 months ago #26224 by blue_Shift
Assuming alias instead of field IDs I have (I hope BBcode works, not a many options in this forum software such as a style box or a five minute edit timer). Hanging my laundry out in the open to dry FBO others.
jQuery(function ($) {
    $('#ce-ff-container-membership_levels membership_levels').on('change', function () {
        if ($(this).val() == 'Household') {
            $('#ce-ff-container-second_member_information').css('display', 'block');
        } else {
            $('#ce-ff-container-second_member_information').css('display', 'none');
        }
    });
});

Please Log in or Create an account to join the conversation.

1 year 11 months ago #26226 by support
Your CSS selector for a Select List Form Field type would look like this
#ce-ff-container-membership_levels select
, so your code should look like this:
jQuery(function ($) {
    $('#ce-ff-container-membership_levels select').on('change', function () {
        if ($(this).val() == 'Household') {
            $('#ce-ff-container-second_member_information').css('display', 'block');
            $('#ce-ff-container-another_field').css('display', 'block');
            // Repeat te line above for all fields you'd like to SHOW.
        } else {
            $('#ce-ff-container-second_member_information').css('display', 'none');
            $('#ce-ff-container-another_field').css('display', 'none');
            // Repeat te line above for all fields you'd like to HIDE.
        }
    });
});

Alternatively, we can create a script that's easier to manage
jQuery(function ($) {
    $('#ce-ff-container-membership_levels select').on('change', function () {
        // Add each field alias to the array below
        var fields = ['second_member_information', 'another_field_alias'];
 
        // Display value default to none
        var displayValue = 'none';
 
        // We'll set the display value to block if the selected option matches our requirement
        if ($(this).val() == 'Household') {
             displayValue = 'block';
        }
 
        // Sets the Display attribute of each field container
        $.each(fields, function( index, fieldAlias ) {
            $('#ce-ff-container-' + fieldAlias).css('display', displayValue);
        });
    });
});

Let me know if you need any further assistance,

Best regards,

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum

Copyright © 2018 IdealExtensions.com. All Rights Reserved.

This site is not affiliated with or endorsed by the Joomla!™ Project. It is not supported or warranted by the Joomla!™ Project or Open Source Matters™. The Joomla!™ logo is used under a limited license granted by Open Source Matters™, the trademark holder in the United States and other countries.
We may collect your IP address and your browser's User Agent string while using our site for security reasons and deriving aggregate information (analytics). This information is retained for a minimum of 1 and a maximum of 24 months.
Feedback