Jump to content
  • 0

Prevent Special Characters in Inline Insert


thead

Question

Hello, 

On my Submission Form DataPage I manage to prevent the user to input a special characters but I also want to prevent my user to input special characters  when they are on my Report DataPage and they are using Inline Insert. Is there a way to achieve this?

 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi Thead,

Yes, it is possible to prevent your user to input special characters using your inline insert. You just need to add Header&Footer on your Configure Search Fields. After that, click your Footer and disabled the HTML Editor, and copy the below codes:

<script type="text/javascript">
document.addEventListener('input', function(event) {

//****CHANGES HERE

var field1= document.getElementById("InlineAddFIELDNAME1");
var field2=  document.getElementById("InlineAddFIELDNAME2");

var array= [field1,field2];

//****END OF CHANGES HERE

for (i=0; i < array.length; i++){

array[i].value=array[i].value.replace(/[^a-zA-Z0-9 ]/g, "");

}


});
</script>

 

Note:

Please update those FIELDNAME1 and FIELDNAME2  to your real  field name where you want to prevent inputting special characters

If you want to add more fields that need to prevent inputting special characters, simply add another variable, say field3, and then add it to the array, as well.

Link to comment
Share on other sites

  • 0

Hello Thead,

Yes it is applicable in Inline Edit, you just need to change your script into this:

<script type="text/javascript">

document.addEventListener("click", function(event){
if(event.srcElement.getAttribute("data-cb-name") == 'InlineEdit'){

document.addEventListener('input', function(e){

//****CHANGES HERE

var field1 = document.querySelector('input[name="InlineEditFIELDNAME1"]');
var field2 = document.querySelector('input[name="InlineEditFIELDNAME2"]');

var InlineArray= [field1,field2];

////****END OF CHANGES HERE

for (i=0; i < InlineArray.length; i++){

InlineArray[i].value=InlineArray[i].value.replace(/[^a-zA-Z0-9 ]/g, "");

}


});

}
});

</script>

 

Hope this helps.

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...