• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Invisible and invalid char in textfield
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invisible and invalid char in textfield


  • Subject: Re: Invisible and invalid char in textfield
  • From: Flavio Donadio <email@hidden>
  • Date: Tue, 13 Sep 2016 14:15:56 -0300

Samuel,


You’re welcome. Feels good to be useful! :-D

I can’t think of any situation where control characters are desirable.


Cheers,
Flavio


> On 13/09/2016, at 13:03, Samuel Pelletier <email@hidden> wrote:
>
> Flavio,
>
> Thank you, this works perfectly.
>
> It could be easily added to ERXWOTextField and WOText element by default...
>
> Is there any situation where control char would be desirable in a web text input (except for the tab and new line) ?
>
> Samuel
>
>
>> Le 13 sept. 2016 à 10:05, Flavio Donadio <email@hidden> a écrit :
>>
>> Samuel,
>>
>>
>> The user might have copied from another app and pasted into the field.
>>
>> The solution is to strip control characters from the user input. As you may know, there are a lot of ways to do that and dependent on the use case. For example, if it’s a multiline text input control (textarea), you may want to keep certain characters like carriage returns, line feeds and tabs.
>>
>> One example of stripping all control characters using pure Java:
>>
>> 	String.replaceAll("\\p{Cntrl}", "”);
>>
>> … and one example of stripping every control character, except for CR, LF and TAB:
>>
>> 	String.replaceAll("[\\p{Cntrl}^\r\n\t]+", "");
>>
>> I am sure NSString has methods for that...
>>
>>
>> Cheers,
>> Flavio
>>
>>> On 13/09/2016, at 09:40, Samuel Pelletier <email@hidden> wrote:
>>>
>>> Hi,
>>>
>>> I just encountered a strange error where a user managed to put a DEL char inside a text field. This char raise an SQL Exception in the server.
>>>
>>> First, I really would like to know how they manage to do this ! I do not even know how to put a DEL (code 127) inside text with the keyboard. I had some case with other control char in the past too.
>>>
>>> Second, is there a wonder way to filter these or a Javascript method to prevent them from the source, or any suggestion to handle this ?
>>>
>>> Real users are alway a source of unpredicted challenges.
>>>
>>> Thank,
>>>
>>> Samuel
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Invisible and invalid char in textfield (From: Samuel Pelletier <email@hidden>)
 >Re: Invisible and invalid char in textfield (From: Flavio Donadio <email@hidden>)
 >Re: Invisible and invalid char in textfield (From: Samuel Pelletier <email@hidden>)

  • Prev by Date: Re: Example code from Apple?
  • Next by Date: WOWorkerThreadCountMax
  • Previous by thread: Re: Invisible and invalid char in textfield
  • Next by thread: Example code from Apple?
  • Index(es):
    • Date
    • Thread