+ Post New Thread
Results 1 to 6 of 6
Web Development Thread, Where did i miss something? in Coding and Web Development; Whats wrong with this? (been staring at a screen to long most likely its something simple). It won't even run ...
  1. #1
    mossj's Avatar
    Join Date
    Dec 2008
    Location
    Leicester
    Posts
    1,466
    Thank Post
    157
    Thanked 189 Times in 174 Posts
    Rep Power
    52

    Where did i miss something?

    Whats wrong with this? (been staring at a screen to long most likely its something simple). It won't even run any of it and throws an error when called.

    Code:
    function session() {
    if (document.getElementById("sessionType").value == "http") {
    document.getElementById("realm").disabled=false;
    document.getElementById("cookieSecretKey").disabled=true;
    document.getElementById("cookieLifetime").disabled=true;
    document.getElementById("cookieLifetimeMedium").disabled=true;
    document.getElementById("includeIP").disabled=true;
    document.getElementById("cookiePathOverride").disabled=true;
    document.getElementById("phpCookiePathOverride").disabled=true;
    document.getElementById("realmRequired").innerHTML="*";
    document.getElementById("cookieSecretKeyRequired").innerHTML="";
    document.getElementById("cookieLifetimeRequired").innerHTML="";
    document.getElementById("includeIPRequired").innerHTML="";
    }
    else if (document.getElementById("sessionType").value == "cookie") {
    document.getElementById("realm").disabled=true;
    document.getElementById("cookieSecretKey").disabled=false;
    document.getElementById("cookieLifetime").disabled=false;
    document.getElementById("cookieLifetimeMedium").disabled=false;
    document.getElementById("includeIP").disabled=false;
    document.getElementById("cookiePathOverride").disabled=false;
    document.getElementById("phpCookiePathOverride").disabled=true;
    document.getElementById("realmRequired").innerHTML="";
    document.getElementById("cookieSecretKeyRequired").innerHTML="*";
    document.getElementById("cookieLifetimeRequired").innerHTML="*";
    document.getElementById("includeIPRequired").innerHTML="*";
    }
    else if (document.getElementById("sessionType").value == "php") {
    document.getElementById("realm").disabled=true;
    document.getElementById("cookieSecretKey").disabled=true;
    document.getElementById("cookieLifetime").disabled=true;
    document.getElementById("cookieLifetimeMedium").disabled=true;
    document.getElementById("includeIP").disabled=true;
    document.getElementById("cookiePathOverride").disabled=true;
    document.getElementById("phpCookiePathOverride").disabled=false;
    document.getElementById("realmRequired").innerHTML="";
    document.getElementById("cookieSecretKeyRequired").innerHTML="";
    document.getElementById("cookieLifetimeRequired").innerHTML="";
    document.getElementById("includeIPRequired").innerHTML="";
    }
    else if (document.getElementById("sessionType").value == "remote_user") {
    document.getElementById("realm").disabled=true;
    document.getElementById("cookieSecretKey").disabled=true;
    document.getElementById("cookieLifetime").disabled=true;
    document.getElementById("cookieLifetimeMedium").disabled=true;
    document.getElementById("includeIP").disabled=true;
    document.getElementById("cookiePathOverride").disabled=true;
    document.getElementById("phpCookiePathOverride").disabled=true;
    document.getElementById("logOutLink").disabled=false;
    document.getElementById("realmRequired").innerHTML="";
    document.getElementById("cookieSecretKeyRequired").innerHTML="";
    document.getElementById("cookieLifetimeRequired").innerHTML="";
    document.getElementById("includeIPRequired").innerHTML="";
    document.getElementById("logOutLinkRequired").innerHTML="*";
    }
    else {
    document.getElementById("realm").disabled=true;
    document.getElementById("cookieSecretKey").disabled=true;
    document.getElementById("cookieLifetime").disabled=true;
    document.getElementById("cookieLifetimeMedium").disabled=true;
    document.getElementById("includeIP").disabled=true;
    document.getElementById("cookiePathOverride").disabled=true;
    document.getElementById("phpCookiePathOverride").disabled=true;
    document.getElementById("realmRequired").innerHTML="";
    document.getElementById("cookieSecretKeyRequired").innerHTML="";
    document.getElementById("cookieLifetimeRequired").innerHTML="";
    document.getElementById("includeIPRequired").innerHTML="";
    }
    }

  2. #2
    mossj's Avatar
    Join Date
    Dec 2008
    Location
    Leicester
    Posts
    1,466
    Thank Post
    157
    Thanked 189 Times in 174 Posts
    Rep Power
    52
    Twigged it

  3. #3
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    Just thinking... if you'd provided the error message and/or context it probably would have helped


    Also, just a thought but perhaps a little more efficient if you use this bit of code instead.

    Code:
    function session() {
    mySessionType = document.getElementById("sessionType").value;
    if (mySessionType == "http") {
    ... at the moment you're forcing it to run the getElementById function repeatedly..

  4. #4
    mossj's Avatar
    Join Date
    Dec 2008
    Location
    Leicester
    Posts
    1,466
    Thank Post
    157
    Thanked 189 Times in 174 Posts
    Rep Power
    52
    How do you get javascript to output error codes?!? All i get is a lil icon at the bottom

    Would of been so helpful.

    Point noted about the "getElementbyID", will change.

  5. #5
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    Quote Originally Posted by mossj View Post
    How do you get javascript to output error codes?!? All i get is a lil icon at the bottom

    Would of been so helpful.

    Point noted about the "getElementbyID", will change.
    Ah.. in firefox there's the error console and firebug... very useful tools for debugging... I'm sure if you create another thread on JS debugging you'll be deluged with ideas and resources.

  6. #6

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,403
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    168
    If you double click on the lil icon you can get a slightly more detailed error message...should also give you the line number where the error is located...

SHARE:
+ Post New Thread

Similar Threads

  1. Eh, Norway? Did I miss something?
    By tech_guy in forum General Chat
    Replies: 28
    Last Post: 18th May 2009, 01:44 PM
  2. When do people buy MISs?
    By VPatel in forum MIS Systems
    Replies: 5
    Last Post: 15th October 2008, 01:35 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •