This is more a question of concept. here is the situation, we have a list of objects, and need to show a modal with a editing/adding form for an object. You have around 10 fields, which is better, to generate the form on the fly with javascipt, to make an ajax call and generate the form with the server language then return it as html and show it, or generate the form inline (when the list is created ) and just show it? I am not asking on how to do it, i can do it in all of the ways i have described, the question is which of these is cleaner and more efficient by today's standards.
-
It depends - not enough data. If there are no severe restrictions both will work, just do what you feel better with. Unless one method takes significantly longer than the other users won't notice a thing! Don't get religious, and ignore experts with an opinion based on no data :)Mörre– Mörre2013-02-11 16:06:56 +00:00Commented Feb 11, 2013 at 16:06
-
no restrictions, i know all of them will work :) and will work good, that is why i said is more a question of concept :).i have used all of the in the past, just want to settle for one, and use only that one, when possible of course.Nikola– Nikola2013-02-11 16:10:47 +00:00Commented Feb 11, 2013 at 16:10
-
Yes, I understand, that is the question I answered. There is no "more correct" solution, given the facts you presented (or not). Only speculation is possible.Mörre– Mörre2013-02-11 16:21:55 +00:00Commented Feb 11, 2013 at 16:21
2 Answers
The third option (generate server side) is the best, for two reasons:
- People with JavaScript turned off can still see the forms. (Make sure you hide them with JS if you're showing them with JS.)
- Screen readers will be able to read the forms.
JavaScript is a great tool to enhance UX, but don't rely on it for things to work.
3 Comments
I would use the "on the fly" method or the third. With the first you may decrease Serverload (it's depending of your user-base and the data) and as the normal user has JS enabled it's not a problem. The third is good because it doesn't requires Javascript enabled, and so even old or mobile devices can display the form correctly. The second is IMHO the worst as it requires JavaScript and takes the server under more load.
When you don't have a big user-base which needs this form often then use the method which is easier for you to develop and maintain.