Jump to content
  • 0

Clear/Reset Form Except for One/Specific Fields


SRAYNOR

Question

2 answers to this question

Recommended Posts

  • 1

Oh! I just found a solution that will clear the form except on specific field/s. 

<input type= "button" value= "clear" onclick= "ClearFields()">

<script type="text/javascript">
 function ClearFields(){
 var fieldexcept = document.getElementById('InsertRecordFieldName').value;
  document.getElementById('caspioform').reset();
  document.getElementById("InsertRecordFieldName").setAttribute('value',fieldexcept);
  }
</script>

 

Link to comment
Share on other sites

  • 0

Hi @SRAYNOR - this code I have is you'll declare what fields you wanted to clear the values. You can use this code if you are using a couple of fields however, it might be a hassle if you have a handful of fields. 

<input type= "button" value= "clear" onclick= "ClearFields()">

<script>

function ClearFields() {

     document.getElementById("InsertRecordFieldName1").value = "";
     document.getElementById("InsertRecordFieldName2").value = "";
}

</script>

I hope this will help. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...