0

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.

3
  • 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 :) Commented 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. Commented 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. Commented Feb 11, 2013 at 16:21

2 Answers 2

1

The third option (generate server side) is the best, for two reasons:

  1. People with JavaScript turned off can still see the forms. (Make sure you hide them with JS if you're showing them with JS.)
  2. 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.

Sign up to request clarification or add additional context in comments.

3 Comments

Yeah... in the age of Google Mail and Facebook... sure, there are a few people without Javascript, granted :) No, seriously, it's one of the issues one could name - but it's not serious in this age. Maybe for some special sites.
The screen reader issue is though. And personally I like browsing without JS. Most sites are just bloated with scripts that do nothing but slow everything down. What I'm saying is, if there is a way to do something without JavaScript, do it. If nothing else, you'll at least get my appreciation :)
i personally liked that one too (the 3-rd option), but since i am a hardcore php and somewhat html coder, i had to ask :), with all the new technologies coming out like node.js, and all *.js, a lot of javascript and json flying around
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.