0

I use this

<a class="waves-effect waves-light btn disabled">Submit</a>

to prevent users submitting the form if they do not input according to the validation rules.

However, when I inspect element through google chrome and just remove the disabled class from the source.

Boom, the button turns to an active button.

So I am just wondering how to prevent this?

Thanks.

Rinku
  • 1,078
  • 6
  • 11
The questioner
  • 724
  • 10
  • 21
  • you can call a javascript function after every 3 seconds, which disables/enables the button after checking the input values @TheQuestioner – Asif Mehmood Jun 01 '15 at 11:03
  • To call a function after evry one/two/three seconds you should study (SetTimeInterval)[http://www.w3schools.com/jsref/met_win_setinterval.asp] – Asif Mehmood Jun 01 '15 at 11:05
  • @MalikAsif Would SetTimeInterval be too heavy for the app? How about adding an event listener? Once no expected class, a function is then called to rectify with no time lag. – The questioner Jun 01 '15 at 11:13
  • To submit are you using PHP on backend. ?? – Asif Mehmood Jun 01 '15 at 11:15
  • currently using Rails 4. – The questioner Jun 01 '15 at 14:32
  • There is one more way that you can call a Rails 4 [server side] file in a javascript function depending on the logic checks and don't create a form [create a simple button and eventHander onclick for that] and pass those variables using XMLHTTP documented well in w3school.com @TheQuestioner – Asif Mehmood Jun 01 '15 at 14:40
  • @MalikAsif thanks for your advice. – The questioner Jun 02 '15 at 01:57

1 Answers1

0

There is no disabled attribute for A tag. If you want to disable hyperlink change it with JS into e.g span tag. Here you have some more solutions

Disabled href tag

Community
  • 1
  • 1
hywak
  • 890
  • 1
  • 14
  • 27