Link to home
Start Free TrialLog in
Avatar of u0867587
u0867587

asked on

It should not change something on the top control (Jquery)

Please look at my Jsfiddle application, you will see a box on top with some controls. please follow these steps below in the fiddle to be able to use it

Step 1: Open the fiddle and you see an options and answers section on top. Open the grid and select either option 3, 4 or 5 as they will all display a textbox underneath in the "Number of Answers" section.

Step 2. Click "Add Question", a new row is added in the table.

Step 3: In the new row you just created, open the grid and select option "true or false" (true or false is the only option where except displaying a textbox for "Number of Answers", it displays a string which is "Only 1 Answer". Now look at the top at the answers and options feature again and you see the "Number of Answers" textbox changes to say "Only 1 Answer".

Now this should not happen, if the option is changed within one of the rows that you have added, it should only change features within that row only. If you look properly you realise in the row you have just added that the option type textbox has changed to "True or False" and that the buttons under the "Answer" column displays the buttons "True or Fals" which is what it is suppose to do. (Ignore "Number of Answers" column in new row you added, I will fix this later).

But if you look at the top control, the Option Type hasn't changed as it still says the option you have chosen between 3, 4 or 5 and the buttons in the "Answer" section hasn't changed as it still display buttons from A to (C if chosen option 3, D if chosen option 4 or E if chosen option 5). That is great, but why is it changing something in the "Number of Answers" section on top? It should leave that section alone as well if something is editted in one of the rows you have added? It should only change if the "Option Type" on top changes.

Can somebody fix this as I have been struggling on this for days. The person who will be awarded 500 points will be the one which shows a working example in the JSFiddle application. (To Save the fiddle just click on the update button on top of the fiddle and it will display a new url).

Thank you
Avatar of mrh14852
mrh14852

Updated your fiddle.

Just look for this in your JS code.

///////
///////
///////
///////
/////// Was this $('.na').show();
/////// Changed to this
            $('.na').hide();
Avatar of u0867587

ASKER

I didn't want you to change $('.na').show(); to  $('.na').hide();. If user selects True or false, it is suppose to show the string "Only 1 Answer". What I am saying is that if something is changed within a row you have added, it should not change anything on the top control for "Number of Answers". If option type is changed within a row you have added, it changes option type and answers buttons within the row but it does not change anything on the top control from option type and answer buttons. I want same for the "Number of Answers" on the top control.
ASKER CERTIFIED SOLUTION
Avatar of mrh14852
mrh14852

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I didn't know about partial points, how do you do that, I am more than happy to give you some points for the other question.
Oh no, I didn't realise there is an accept multiple solutions button, i'm guessing that does it. How about I award you full points on this question to make up for it and then I post this question again?
I would have to rewrite a lot of the code in my way to get it to do what I think you want it to do.  I don't know what the full scope of your project is but by looking through your code I think you have way too much code there to do just the basic stuff.

I made the following fiddle.  In this fiddle you will find the ability to add table rows and in each row is a button that will change the text in the columns in the table.  Now just so we are clear it doesn't do all the stuff you have in the code in your fiddle...but...I think this should give you a general idea of how to generate the code and use IDs to work on each row individually.  For example add a few rows and then click "open grid" for just one of the rows.  Now that you are using IDs you can do all sorts of fancy stuff with it.  And as you can see all I have is just a few lines of code to accomplish it.  Have a look at it and see if it is helpful to you.

http://jsfiddle.net/ASHRg/1/