SitePoint Sponsor

User Tag List

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

    it displays a string where it shouldn't do

    I have a slight situation in my jsfiddle which I believe can be explained easily if you follow the steps below but what is happening is a string is appering when it shouldn't do.

    - **Step 1:** open the grid and select option 4, buttons A to D appears below.

    - **Step 2:** click on the "Select all buttons" button, all buttons (A - D) are selected (turn green) and Number of Answers textbox displays the number 4 as 4 buttons have been selected

    - **Step 3:** Click on the "add question" button, this will insert your details into a new row.

    - **Step 4:** Now in the row you have just added, select open grid and click on either option "True or False" or "Yes or No". Now what happens is that if you at the "Number of Answers" column next to the "Option Type" column, it will display the string "Only 1 Answer". This is fine.

    The problem is that if you look at the control at the top and look at the "Number of Answers" section, it displays "Only 1 Answer", this should not happen. It should only display "Only 1 Answer" at the top if the "Option Type" option at the top is "True or False" or "Yes or No", not the "Option Type" in the row you have just inserted is "True or False" or "Yes or No".

    Does anyone know how to figure this out?

    code is in jsfiddle, click http://jsfiddle.net/dtJaK/3/

  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
    Does anyone know how to figure this out?
    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 string 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 string 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.

  5. #5
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Displaying a string problem

    What is happening is that when the user selects the option "True or False" in a particular row, a string is appering in two places where actually it is suppose to appear in one place. If you follow the steps in my fiddle then you will understand what is happening.

    - **Step 1:** open the grid and select option 4. You will see that a textbox below the option appears for the number of answers. (This happens for options 3, 4 and 5 but not True or False which instead displays a string "Only 1 Answers").

    - **Step 2:** Click on the "add question" button, this will insert your details into a new row.

    - **Step 3:** Now in the row you have just added, select open grid and click on option "True or False". Now what happens is that if you look at the "Number of Answers" column next to the "Option Type" column, it will display the string "Only 1 Answer". This is fine.

    The problem is that if you look at the control at the top and look at the "Number of Answers" section, it displays "Only 1 Answer", this should not happen. It should only display "Only 1 Answer" at the top if the "Option Type" option at the top is "True or False", not the "Option Type" in the row you have just inserted is "True or False".

    Can anyone fix this because I cannot figure out what to do?

    code is in jsfiddle, click [here][1]

    [1]: http://jsfiddle.net/dtJaK/10/

  6. #6
    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
    Can anyone fix this because I cannot figure out what to do?
    This thread looks familiar but I might be wrong.

    In any case, 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 string 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 string to run.

  7. #7
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No you are right about a similar thread, I posted a similar thread about 4-5 hours ago but even though you told me what to do, I still wasn't able to solve it. So in this thread I have reduced the code completley and changed the steps. In the other thread I have posted a message stating to go to this thread instead and to please tell me how to delete the other thread because I do not know how to delete a thread

  8. #8
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I dont want a string to change at top if option in row changes

    What is happening is that when the user selects the option "True or False" in a particular row, a string is appering in two places where actually it is suppose to appear in one place. If you follow the steps in my fiddle then you will understand what is happening.

    Step 1: open the grid and select option 4. You will see that a textbox below the option appears for the number of answers. (This happens for options 3, 4 and 5 but not True or False which instead displays a string "Only 1 Answers").

    Step 2:Click on the "add question" button, this will insert your details into a new row.

    Step 3: Now in the row you have just added, select open grid and click on option "True or False". Now what happens is that if you look at the "Number of Answers" column next to the "Option Type" column, it will display the string "Only 1 Answer". This is fine.

    The problem is that if you look at the control at the top and look at the "Number of Answers" section, it displays "Only 1 Answer", this should not happen. If something is change withing a row, it should not alter anything on the top control. I have manged keep Option Type and Answer buttons from altering when its same control is altered within the row but I do not how to do it for Number of Answers.

    Can anyone fix this because I cannot figure out what to do? Please test your coding in the fiddle if you want to attempt to fix this by coding.

    code is in jsfiddle, click http://jsfiddle.net/dtJaK/10/

  9. #9
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    This appears to be the same question as from your other thread.

    Your problem is easy to fix, but since you have multiple threads asking exactly the same question how am I supposed to know which thread to reply to? I could be wasting time replying to one thread when someone else has already posted a solution in one of your other threads

    To me it looks like you are bumping your threads by proxy, ie... cross-posting which is frowned upon.

    Why not just stick with a single thread?


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
  •