Sabi007
Sabi007

Reputation: 279

How to restrict editing `disabled` attribute of HTML button from HTML source code

I have one Button like this:

<input type="button" class="clsinvoice" value=" " id="btnInvoice" 
style="display: inline;" onclick="OpenInvoice();" disabled>

which I have set as disabled by default. After some operation, it gets enabled.

The problem I am facing is that, anyone who knows basic HTML code can edit the 'disabled' attribute and can use the button, and so on.

Is there any way to restrict the editing of that Attribute???

Upvotes: 1

Views: 1063

Answers (2)

chinshuu
chinshuu

Reputation: 61

Actually, just disabling html element is quite vulnerable to what you have just said. What I usually do is to restrict both html and javscript function to be run on the front-end, as well as the methods at the server-side

Upvotes: 1

andreasnico
andreasnico

Reputation: 1488

No there is not. You must never trust what comes from the client (i.e the browser, as a request to the server etc). You must check this server side to be sure that the operation is allowed.

Upvotes: 3

Related Questions