Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dleroari's avatar

Prevent user from changing button state from Inspect Element

I have a button that simply submits the form when user has filled out the required fields. After user have submitted, the button is disabled.

Since the html is shown in client-side, everyone has the ability to access "Inspect Element" and manually remove disabled, thereby submit the form.

Is there a way I can prevent the user from doing this?

I use ternery statement to disable the button. ​

{{ ($status > 0 ? 'disabled' : '') }} 
0 likes
2 replies
topvillas's avatar

No, you can't.

What you can do though is remove the button from the DOM and replace it with something that won't submit the form.

crnkovic's avatar
crnkovic
Best Answer
Level 43

Nope, you can't trust the users on the client-side (frontend), therefore perform additional validation on the backend.

3 likes

Please or to participate in this conversation.