3 ms·
Why does the form have to be generated dynamically by JS? A much better solution would be to generate the markup on the server-side. It should be easy enough t
by gberger 13y ago
Why does the form have to be generated dynamically by JS?
A much better solution would be to generate the markup on the server-side. It should be easy enough to port this to Node, and a bit more of work for other major backend languages like Ruby, Python and PHP.
It could even be implemented as a webapp that takes the input JSON on the left side, and spits out HTML on the right, which I could paste into my site markup directly.
Right now, the trade-off is too big for the developer-time convenience of generating forms dynamically.
- dmpayton 13y agoIt's more to do with separation of concerns. The presentation of data should be the responsibility of the front-end (in this case, the data is a form description and the front-end is in your web browser). This is very useful for when you have a single API that drives your web, Android, and iOS apps. Your back-end just describes the form in JSON and each front-end is responsible for how that form renders. Alpaca is just a shortcut for your web front-end.
- chime 13y agoYou hit the nail on the head. We use a system like that and it is fantastic. As close to DRY as you can get.
- cbsmith 13y agoYou get the irony though that this was the original purpose of SGML (which admittedly HTML 1.0 thoroughly screwed up). It seems perfectly reasonable to render the page using HTML and have the render logic for browsers or what have you be in the form of style sheets and Javascript.
- camus2 13y ago> a bit more of work for other major backend languages like Ruby, Python and PHP. Java ,PHP ,Ruby and Python have had excellent form libraries for years ,handling multipage forms ,complex client/server/db validation , etc... I say it's more difficult to do anything in node,as soon as you have a complexe domain model.