0

Inappropriate Text Input

1217 0 2
Posted   one year ago

Hi All, 

 

Im creating a course for some, lets say, unruly teenagers and want them to be able to enter a username using a Text Input element. 
 
 
Is there a way of making sure its only appropriate language used? 

Comments

( 0 )

Answers  ( 2 )

0
avatar Chris Van Wingerden   |    
Posted   one year ago

I assume you're saving what they type for the username as a variable to display back to them later?

It probably isn't possible to put conditions on what they type to prevent the saving of unwanted text, there'd be so many possible words. Plus add in the creativity of youth and the list would be endless.

How important is the uniqueness of the username? You could allow them to type in anything, but then set the variable to be something else, i.e., don't tie the type in box to the variable, just set the variable automatically when the page loads. The feedback instructions could explain that "for this simulation we'll just use a standardized username". 

Or maybe they need to type in a specific username (based on your instructions), and you could use conditions to confirm that's what they typed.  

 

Comments

( 1 )
0
one year ago     tom.clark     0   |   2  

Yes, the username will be used to reference the user throughout the course and the uniqueness is very important.

I could use conditions to prevent the obvious though I suppose.

0
avatar Paul Schneider   |    
Posted   one year ago

While there isn't anything built in you could use our ContentAPI to get the variable value for the text input and then in your HTML widget sanitize the text (e.g., https://www.folkstalk.com/2022/09/sanitizing-user-input-javascript-with-code-examples.html)

 

 

Comments

( 0 )