I’ve got a form that I build when you click an edit button in the table. See the fiddle here:
http://jsfiddle.net/UtNaa/42/
The problem is that it is not showing the right form. If it is AXIS:
if (cameratype == "AXIS")
it builds a form with 8 fields, otherwise it builds a form with 5 fields. To see this behavior best, go to the fiddle and click the first row “Edit” button. See the form it builds, it has 5 fields. Now click the next “Edit” button for the next cameratype. It shows the same 5 fields, when it should show 8 fields.
But if you refresh your browser on that fiddle and click the second “Edit” button in the table this time, you can see that it does show 8 fields. But again if you click on “Edit” for the first row it is also 8 instead of 5 fields.
So if you click cameratype=WEBCAM it should show 5 fields and when you click cameratype=AXIS it should show the 8 fields. Note that there are common fields between the two. Any ideas what I’m doing wrong?
This line:
Is giving you the problems. Essentially, it’s just showing you the same form you’ve first created. You need to remove the form on
cancel/apply, or try to detect if the correct type of form is available and select/show that one.Working example using
$.empty(): http://jsfiddle.net/UtNaa/44/