I would expect the commented out line to work but it doesn’t and courses an error. Any ideas? By the way, I only ever see the section that is set to default section.
Unfortunately this isn’t just a typo. I have corrected the sections but still no go. The error I get is cannot set property “enabled” of undefined to false. My conclusion is that it doesn’t understand what the default section is. Currently the line I have set is:
Ah, I think I understand what happens. There is no such thing as “default Section” unless you actually have a section that is literally called default Section. This isn’t a smart heuristic language, it’s a literal call to a section name.
Do you have any section that is named differently than PersonalDetails, Question1 and Thankyou? If you do, you’ll have to manually disable those sections one by one. If you don’t, then that line that doesn’t work is completely unnecessary in your script.
There are only three sections in this template. Whenever I create web sections, one of them will always be default. The control script above is disabling all the pages so there should be nothing to display. However, when I browse to the website, the section that is set to default is visible.
So, how do I disable the default section so that my script will do something?
If you disable all three sections, Connect will most definitely display the default section otherwise it would have nothing to show, which of course is not what you want.
Unless there’s an issue in the software that I’m not aware of, having only one section enabled should only show that section.
Perhaps the issue that you’re actually having though is that the script in your initial post wouldn’t work. I wasn’t 100% sure of this, but a bit of research does confirm that doing = something == ‘something’; would NOT work to establish a true or false condition. What you’re looking for is a shorthand IF condition in JavaScript. This would work :
What’s between the parentheses is the condition, between ? and : is “what to return when the condition is true”, and after that is “what to return when the condition is false”.
I think there’s an issue in the software that you’re not aware of. I now have two of the sections set to …enabled = false and the third set to …enabled = true but the section that is visible when I browse to the website is always the section that is set to default, even though the page that is set to default is not enabled.
I’m currently trying to escalate this through UK support but I don’t think they understand the issue yet.