Using prepopulated form, submit only changed fields

前端 未结 3 1414
囚心锁ツ
囚心锁ツ 2021-02-11 03:45

I have an html form that uses select and text inputs. The form comes pre-populated with default values. How can I submit only the inputs that were changed by the user from the

3条回答
  •  情歌与酒
    2021-02-11 04:28

    If you can use HTML5, you can use the placeholder attribute, example. Keep in mind this won't work with older browsers like IE6-8.

    If you can't use that, you'll have to do a detect on form submit with javascript and check the value of the objects your submitting. The other option is to have a label of your preview text and hide it when input boxes are selected or contain a value that isn't empty.

提交回复
热议问题