Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    4
    Thanked 0 Times in 0 Posts

    a problem with a switch

    A function which allows the user to enter the day of the week as a number or string (i.e., 1=Monday, 2=Tuesday…..5= Friday), and displays the labs and lectures (including the times and locations) you have on that particular day.

    i dont know how to make the swith so it ca read numbers and string...i mean for 1 and monday to do the same thing
    (thanks for youre help in advance)

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Quote Originally Posted by valyii View Post
    A function which allows the user to enter the day of the week as a number or string (i.e., 1=Monday, 2=Tuesday…..5= Friday), and displays the labs and lectures (including the times and locations) you have on that particular day.

    i dont know how to make the swith so it ca read numbers and string...i mean for 1 and monday to do the same thing
    (thanks for youre help in advance)
    It would make more sense for the user to select the day of the week from a select list. Then you avoid verification problems.

    <option value = 0> Sunday </option>
    <option value = 1> Monday </option>

    Quizmaster: What D do you call a native of Denmark?
    Contestant: Dutch

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    valyii (11-05-2012)

  • #3
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Use a SELECT, set the values as desired, and give it an onchange event handler, passing the value, not the text (ie, <option value=1>Monday</option>)

    function name(arg){
    switch(arg){
    case 1:
    blah blah blah;
    break;
    case 2:
    blah blah blah;
    break;
    ...
    case 7:
    blah blah blah;
    break;
    }
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • Users who have thanked WolfShade for this post:

    valyii (11-05-2012)

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    AH.. Philip beat me to it! GMTA
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".


  •  

    Posting Permissions

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