10 examples of 'reset form after submit' in JavaScript

Every line of 'reset form after submit' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
97reset() {
98 const { resetForm, setAgreed } = this.props;
99 setAgreed(false);
100 resetForm();
101}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

34function resetForm(form, cancelPressed){
35 var formParent = form.parent();
36 form.removeClass("inactive");
37 form.find("input[type='submit']").attr("disabled", false);
38 formParent.addClass("hidden");
39 if(!cancelPressed)
40 form.find(".comment-textarea").val("");
41}
279function reset(){
280 $("#appUpgradeForm").form("reset");
281}
228reset() {
229 for (let form_element of document.getElementsByTagName("input")) {
230 var name = form_element.getAttribute('name');
231
232 if (this[name]) {
233 this[name] = '';
234 }
235 }
236
237 for (let form_element of document.getElementsByTagName("textarea")) {
238 var name = form_element.getAttribute('name');
239
240 if (this[name]) {
241 this[name] = '';
242 }
243 }
244
245 for (let form_element of document.getElementsByTagName("select")) {
246 var name = form_element.getAttribute('name');
247
248 if (this[name]) {
249 this[name] = '';
250 }
251 }
252}
90resetForm() {
91 this.props.form.resetFields();
92}
93function clearForm() {
94 $('#inputForm')[0].reset();
95 $('input').removeAttr("disabled");
96}
149public reset() {
150 this.username = '';
151 this.password = '';
152 this.loginFailed = false;
153 this.serverErrorMessage = '';
154 this.$validator.reset();
155}
142function clearForm() {
143 $('#inputForm')[0].reset();
144}
212function reset() {
213 $('#captureParams').val('');
214}
78reset() {
79 for (const c of this._childComponents()) c.reset()
80}

Related snippets