Home Stop form from submitting without javascript
Reply: 2

Stop form from submitting without javascript

Tri Nguyen
Tri Nguyen Published in 2018-02-14 00:38:26Z

The problem is quite simple to understand but quite hard to execute. I am currently facing some clients that turn off their browser Javascript by default and this screw up my website a bit. Since my website send ajax requests on form submit, stop the form submit using Javascript, turning JS off means the form will be sent through and that's unexpectedly.

What I am trying to ask and achieve is whether it is possible to just using html purely to stop a form from submitting?

visibleman Reply to 2018-02-14 01:05:47Z

I think the best answer is; to have the original form action point to an error page, asking the user to turn on javascript. Then let your javascript code fill in the form action parameter, once the ajax state is complete.

Alternatively or additionally, you could use a <noscript> tag as suggested in the comments, to generate a message on the original page.

W. Seun
W. Seun Reply to 2018-02-14 00:43:51Z

I think you can simply change your submit button tag to an input and style it to look like a button and remove the type="submit" that's all. with out ajax it will not respond.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.317108 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO