Live data from Hacker News

Substituting JavaScript with HTML

codementor.io

31–40 of 42 posts

Re: Substituting JavaScript with HTML

#31
post #16

Earlier quoted context omitted.

Alternative HTTP methods (only GET and POST are supported in HTML forms). Also, there is the setting of HTTP headers which requires JavaScript.

I just use a hidden field to handle that.

That doesn’t actually handle that however (you’re just telling a server that your get/post intends something else).

The server has to support it.

Re: Substituting JavaScript with HTML

#32
post #23
post #19

Earlier quoted context omitted.

Form validation doesn't need to be done in Javascript. I'd argue that it shouldn't ever be done in Javascript, because that means implicitly trusting the client, which is always a bad idea. Since any sane application revalidates the response on the server anyway, client side validation is just a gimmick, it's not necessary.

> client side validation is just a gimmick Server side validation requires a whole page round trip. The user will have to wait, lose their scroll position... you can't rely on client side validation only, but neither is it a gimmick.

What is ajax

Re: Substituting JavaScript with HTML

#33
post #29

I do have to say that it has been really annoying to watch my front end team miss deadlines to keep up with Angular versions. They also seem to introduce pretty basic bugs. What annoys me the most is there no reason for our product to have be a fancy SPA, it would be just as useful if it were a static site. The most complicated form element we have is a number input and a Stripe GUI. We also have a user facing cli to…

> there no reason for our product to have be a fancy SPA, it would be just as useful if it were a static site.

So common, so true, but certainly an argument you'll never win.

> the cli generates about 2/3s of our users requests

This is more interesting, I think -- is that widely known internally? Is that number growing or shrinking? Do users start on the web interface and migrate to the CLI, or do they pick one and stick with it? Do they use the CLI by hand, or do they have scripts to make the interface better?

The whiz-bang web interface may drive sales better, but improving the way the product is used will drive retention. Try to stay positive about it, and keep a wide perspective, but do make sure that what you know and what you think are known "up the chain."

Re: Substituting JavaScript with HTML

#34
post #23

Earlier quoted context omitted.

> client side validation is just a gimmick Server side validation requires a whole page round trip. The user will have to wait, lose their scroll position... you can't rely on client side validation only, but neither is it a gimmick.

What is ajax

> What is ajax

Server-side validation relying on JavaScript. You still have to wait for the server to respond, and now you need to implement UI to tell the user something is happening in the background. But at least you can start proactively validating before the user actually submits the form, so there's that.

Re: Substituting JavaScript with HTML

#35
post #14
post #12

Earlier quoted context omitted.

I was thinking this too. Forms never _needed_ Javascript to post. It's always worked this way. Am I missing something?

Form validation.

In special cases, maybe. Basic validation (Email looks like email, number contains no text...) is done by the browser automatically if you use semantically correct types: http://diveintohtml5.info/forms.html#validation

Re: Substituting JavaScript with HTML

#37
Many web applications are data-entry centric so yes use more HTML and use less JavaScript because forms are builtin. However, for anything that goes beyond this, JavaScript is not just an option - it is a must. You can avoid it but you will also not going to create anything interesting.

Re: Substituting JavaScript with HTML

#38

Coolest thing is: You can do completely without JS: Browser handles sending, backend handles processing. Yes, blows my mind too..

CSRF protection, double submits, etc etc etc etc

I always wish I could ship something like that, and it does sometimes start out that way. But it never lasts, not anywhere that cares more about UX than they care about HTML purism.

Re: Substituting JavaScript with HTML

#39
I've mentioned it before but I had a "aha" moment when I found intercooler js, it would be awesome to have 3-5 JavaScript functions instead of always rewriting and building Ajax request. Only problem with intercooler is it expects HTML in return instead of json.

Re: Substituting JavaScript with HTML

#40
post #23

Earlier quoted context omitted.

> client side validation is just a gimmick Server side validation requires a whole page round trip. The user will have to wait, lose their scroll position... you can't rely on client side validation only, but neither is it a gimmick.

What is ajax

[deleted]
Post reply on HN