Enable 'submit' button only if a value in

2019-08-09 01:44发布

问题:

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.

回答1:

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.



回答2:

  • 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



标签: forms button