SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    incorrect number is displayed

    When the user clicks on the "Select All Buttons" button, it should display a number in the Number of answers text-box (.numberAnswerTxt) which is the number of buttons that are selected but it is not quite displaying this.

    Follow the steps in my fiddle to be able to see what is happening:

    Step 1: open the grid and select option "4". Buttons A to D would be displayed.

    Step 2: Click on the "Select All buttons" buttons, this selects all the buttons A to D (they all turn green) and in the number of answers textbox it shows the number 4 as all 4 buttons are selected.

    Step 3: Click on the "Add Question" button, This adds a new row showing the details you have entered.

    Step 4: now open the grid again at the top and select option 6, Now click on the "Select All Answers" button, all 6 buttons have been selected (A to F) and the number of answers textbox displays the number 6.

    Step 5: For the last time open the grid and select option 4 again, now you see 4 buttons (A to D) all selected yet the textbox still states 6 even though the it should display 4 as you only see 4 buttons selected.

    So in the example above what needs to happen so that the number 4 is displayed except for the number 6?

    code is in jsfiddle click http://jsfiddle.net/uXZcC/21/

  2. #2
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by sachinmaster View Post
    So in the example above what needs to happen so that the number 4 is displayed except for the number 6?
    You have a logic error in your code, assuming no syntax errors are being generated. To fix the logic error, locate the line of code that displays the unwanted number and then step back through your code to check variable values and/or IF etc conditions that are triggering that unwanted line of code to run. Then fix the code that is causing the line of code that displays the unwanted number to run.

  3. #3
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well is it because I have the same class which displays the string at the top control and one which displays the string for each row if option equals "True or False" (class is .na)?

  4. #4
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by sachinmaster View Post
    Well is it because I have the same class which displays the string at the top control and one which displays the string for each row if option equals "True or False" (class is .na)?
    Without spending time debugging your code, I don't know. I've described the general process of how I would go about debugging your code but I'm not going to actuially spend time doing it. If you wrote all that code, it shouldn't be too difficult for you to debug the logic errors.

    It's probably a bit late for this case, but in the future maybe consider writing you code in small chunks and test each chunk thoroughly before writing any more code. At least then if an error occurs you know it's most likely due to the latest chunk of code you added. Too many people write code from go to whoa and then spend ages in forums hoping someone will go through their code and fix it for them.

    Without spending time actually fixing your code, there is nothing more I can do.


Tags for this Thread

Bookmarks

Posting Permissions

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