Project

General

Profile

Actions

Bug #2825

closed

cbsubs conditional display no longer functions when step by step is used

Added by krileon over 12 years ago. Updated almost 12 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Target version:
Start date:
28 September 2011
Due date:
% Done:

0%

Estimated time:

Description

This is likely due to the re-arranging of the DOM. See how step by step can be done without destroying CBSubs jquery selectors or perhaps re-establishing the selectors when done with the move.

Actions #1

Updated by krileon over 12 years ago

  • Target version set to 1.2.0
Actions #2

Updated by krileon over 12 years ago

  • Status changed from New to Rejected

CBSubs uses Fade instead of show/hide on registration, but Fade can't hide/show elements were their parent is hidden, which is the case when using tabs as the fields parent is hidden due to them being on a tab that isn't selected. Unfortunately there's no fix that can be done from CB Conditionals side.

Actions #3

Updated by softforge over 12 years ago

krileon wrote:

CBSubs uses Fade instead of show/hide on registration, but Fade can't hide/show elements were their parent is hidden, which is the case when using tabs as the fields parent is hidden due to them being on a tab that isn't selected. Unfortunately there's no fix that can be done from CB Conditionals side.

I have just come up against this one so thought I'd have a hack, and had success!

I changed the following code in cbpaidsubscriptions.js from:

// Show or hide fields:
        if ( cbpayFirstTimeDone ) {
            for (var i=0;i<fieldsToShow.length;i++) {
                $('#cbfr_' + fieldsToShow[i] + ',#cbfrd_' + fieldsToShow[i] + ',#cbfr_' + fieldsToShow[i] + '__verify').fadeIn("slow").find('.fieldCell,.cb_field').find('.requiredDisabled').removeClass('requiredDisabled').addClass('required').attr('mosReq','1');
            }
            for (var i=0;i<fieldsToHide.length;i++) {
                $('#cbfr_' + fieldsToHide[i] + ',#cbfrd_' + fieldsToHide[i] + ',#cbfr_' + fieldsToHide[i] + '__verify').fadeOut("slow").find('.fieldCell,.cb_field').find('input.required,select.required,textarea.required').removeClass('required').addClass('requiredDisabled').attr('mosReq','0');
            }
        } else {

To this (which is just replacing the fade to show/hide):

        // Show or hide fields:
        if ( cbpayFirstTimeDone ) {
            for (var i=0;i<fieldsToShow.length;i++) {
                $('#cbfr_' + fieldsToShow[i] + ',#cbfrd_' + fieldsToShow[i] + ',#cbfr_' + fieldsToShow[i] + '__verify').show().find('.fieldCell,.cb_field').find('.requiredDisabled').removeClass('requiredDisabled').addClass('required').attr('mosReq','1');
            }
            for (var i=0;i<fieldsToHide.length;i++) {
                $('#cbfr_' + fieldsToHide[i] + ',#cbfrd_' + fieldsToHide[i] + ',#cbfr_' + fieldsToHide[i] + '__verify').hide().find('.fieldCell,.cb_field').find('input.required,select.required,textarea.required').removeClass('required').addClass('requiredDisabled').attr('mosReq','0');
            }
        } else {

Now the CBSubs registration logic works perfectly within the hidden tabs! Plus it doest matter that they font fade because you font see them appearing or dispersing.

I know it's a hack but I thought I'd document it in case anyone else desperately needed this to work, like us.

Interestingly, this makes the if statement exactly the same as the else statement (not shown here) so a potential [pseudo] fix could be something like this:

        // Show or hide fields:
        if ( cbpayFirstTimeDone || [!cbConditionalIsLoadedAndInTabMode]) {

Obviously this fix would need to be applied to CBSubs but I though it might help to post my findings here.

Thanks for everything!

Actions #4

Updated by softforge about 12 years ago

Another possible fix that could be done in the plugin would be to use visibility: hidden; rather then display: none; as I can have just come across a similar problem and the JavaScript could affect hidden elements when using visibility. Just a though, but it could have knock-on effects to the layout:

http://www.w3schools.com/css/css_display_visibility.asp

Actions #5

Updated by krileon about 12 years ago

Visibility doesn't hide the elements space. So you'd see gaps between your inputs. The solution is to fix CBSubs, which we've intentions of doing with a later release.

Actions #6

Updated by pepperstreet almost 12 years ago

Is this issue/bug still there? Since Conditional and CBsubs got some updates... i just wondered about the open status and target version 1.2

Actions #7

Updated by krileon almost 12 years ago

Is this issue/bug still there? Since Conditional and CBsubs got some updates

It's fixed in CBSubs 1.3 already (fix is in the RC releases).

i just wondered about the open status and target version 1.2

It's marked Rejected and the version was CB Conditional version; not CBSubs version.

Actions

Also available in: Atom PDF