1

I have a php form for a website containing text fields which display values retrieved from my database and also a submit button. I would like the submit button to be disabled by default and to only be clickable if the user has made a change to one of the text fields in the form. However if they were to change it back to the default value, the button would automatically be disabled again. Any help is appreciated.

Aetos
  • 25
  • 1
  • 5
  • You can render it disabled by default and have JavaScript handlers watching the inputs for change events to enable it. Maybe render some hidden fields or directly render JavaScript values to store the "originals" and, on those change events, check the current values against the originals to determine if the button should be enabled or disabled. – David Jan 18 '13 at 15:14
  • refer this https://stackoverflow.com/questions/16593222/disable-submit-button-unless-original-form-data-has-changed – Govindarajan Oct 12 '17 at 14:18

2 Answers2

0

You need to use javascript. For each field, you must make a eventhandler that checks the value and then enables or disables your submit-button.

MortenSickel
  • 2,118
  • 4
  • 26
  • 44
0
  • Declare a Variables for each Text box
  • Then assign the values that you Retrieving from database to the text box and a Variables...
  • At the time of Button_Click compare the Value of text box with the Variables
  • If BOTH are Same then there is no EDIT's occur

That's all

Pandian
  • 8,848
  • 2
  • 23
  • 33
  • This sounds like server-side logic, which doesn't really achieve the desired effect of enabling/disabling the button while the user modifies values. Also, this shouldn't happen "at the time of Button_Click" because that would imply that the button is always enabled, which isn't what's being asked. – David Jan 18 '13 at 15:26