sachinmaster — 2012-01-02T18:46:01-05:00 — #1
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/
system — 2012-01-02T19:06:39-05:00 — #2
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.
sachinmaster — 2012-01-02T19:18:44-05:00 — #3
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)?
system — 2012-01-02T19:28:15-05:00 — #4
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.