In this article, we will guide you on how to remove unwanted special characters from input fields in submission forms.

Steps to remove the special characters from input fields:

  1. Edit your Submission Form DataPage.
  2. Add a Header and Footer in the Configure Fields screen of the DataPage wizard.
  3. Disable the HTML Editor in the Footer section.
  4. Copy and paste the following JavaScript in the Footer.
    <script type="text/javascript">
    document.addEventListener('BeforeFormSubmit', function(event) {
    var x = document.getElementById("InsertRecordFIELDNAME").value;
    document.getElementById("InsertRecordFIELDNAME").value=x.replace(/[^a-zA-Z0-9 ]/g, "");
    });
    </script> 
  5. Replace the FIELDNAME in the JavaScript with name of the field. For example, if the name of the field is First_Name, then it should be InsertRecordFirst_Name.
  6. Save the DataPage.

Note: You can apply the JavaScript to a Single Record Update Form by following the above steps and changing instances of InsertRecord to EditRecord.

Note: This article uses external HTML, JavaScript, or third-party solutions to add functionality outside of Caspio Bridge’s standard feature set. These solutions are provided “as is” without warranty, support or guarantee. The code within this article is provided as a sample to assist you in the customization of your web applications. You may need a basic understanding of HTML and JavaScript to implement successfully.