views:

42

answers:

1

In the "Find a Therapist" box on my site: http://www.rscpp.co.uk/ I show/hide other fields based on whether the user selects Face to Face, Telephone, Email, or leaves this unselected. I used to do this with:

function showHideF2fOptions() {

    contact_method = document.therapist_search.contact_method.options[document.therapist_search.contact_method.selectedIndex].value;
    if(contact_method == 'f2f' || contact_method == '0') { 
        showDivId('f2f_options');
    } else {
        hideDivId('f2f_options');
    }
}

However IE (8, not sure of others) has started giving contact_method the value of http://www.rscpp.co.uk/f2f or http://www.rscpp.co.uk/0. So I have now changed my code to deal with those conditions and the functionality is now back in working order. However, it would be nice to fix it properly so I didn't have the hack:

if(contact_method == 'f2f' || contact_method == 'http://www.rscpp.co.uk/f2f' || contact_method == 'https://www.rscpp.co.uk/f2f' || contact_method == '0' || contact_method == 'http://www.rscpp.co.uk/0' || contact_method == 'https://www.rscpp.co.uk/0') 

I can't think of anything that I have changed here, only thing is Google Analytics inclusion (has always been included, but maybe it causes some conflict?).

Any ideas?

A: 

I have solved this, the problem was that the variable was not initialised:

var contact_method = 

Still, a strange bug that just appeared on its own, maybe in a new version of IE....

Newmania