Enable 'submit' button only if a value in

2019-08-09 01:05发布

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.

标签: forms button
2条回答
Animai°情兽
2楼-- · 2019-08-09 01:40
  • 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

查看更多
做个烂人
3楼-- · 2019-08-09 02:00

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.

查看更多
登录 后发表回答