views:

77

answers:

2

I'm trying to use the show and hide to display a different set of select options when a certain report type is selected. I have a couple problems with this: The .show .hide only execute properly if I pass params, slow fast, in the the first result of my conditional statement. If I take out the params or pass params in both results, only one select shows and it never changes.. here's is the code that currently kind of works.

        if ($('#ReportType').val() == 'PbuseExport')
        {
            $('#PbuseServices').show('fast');
            $('#ReportServiceDropdown').hide('fast');
        }
        else
        {
            $('#PbuseServices').hide();
            $('#ReportServiceDropdown').show();
        }

After i've used this control I am taken to a differnt page. When I use the control again, it reatins the original search values and repopulates the control. Then again I only want to show one select option if a certain report is chosen.. This works correctly if the report type I originally searched on is not the "PbuseExport". If I searched on the report type "PbuseExport", then both selects show on the screen, and only until I change the report type does it show only one select. I know this probably isn't very clear.. Here is the code that handles the change event on the report type drop down.

    var serviceValue = $("#ReportType").val();
    switch (serviceValue)
    {
        case 'PbuseExport':
            $('#PbuseServices').show('fast');
            $('#ReportServiceDropdown').hide('fast');
        default:
            $('#PbuseServices').hide();
            $('#ReportServiceDropdown').show();
            break;
    }
+3  A: 

In the second piece of code you also need a break after the case statement. The select will fall right through to default. Confirming....

Yep you need a break also think about just using an if statement instead of a case.

Clutch
testing right now.. can't believe I missed that
Avien
nope.. doesn't change anything. and I can't use firebug..
Avien
why cant you use firebug?
mkoryak
Watchout for browser caching.
Clutch
because my employer only allows specific programs to be used..
Avien
Rise up from your shackles and revolt. Viva La Firebug!!!!
Clutch
Your employer is a dimwit.
iconiK
+1  A: 

Turns out my project file is corrupted..along with quite a few other major issues.. and now I have to reinstall VS
:|

Avien
Yep, I was just about to suggest that.
C. Dragon 76