views:

663

answers:

1

In Adobe Flex, I'm trying to restrict the input to allow the user to type only a list of IP addresses, separated by a space or a comma. Currently, I have:

I expected it to be able to enter all alpha-numeric characters, periods, colons, spaces and commas.

However, the commas I cannot be entered, unless the first character is a comma. It's really strange, and I can see no reasoning behind it.

Any help appreciated, thanks.

A: 

Can you show us the function you have already written so that we might be able to point you to where your mistake may be? Are you allowing for IPv6 or only IPv4 addresses? If only IPv4, you would not want to allow alpha characters, only numeric, periods and commas.

Also, would it make more sense to allow the person to enter in the ip addresses one at a time, let them hit enter and add that particular address to a list and then allow them to work on the next one, instead of having them enter several and then not knowing where a typo might be?

Ryan Guill
I just realized that the < and > characters might have just removed my flex code from the post. Anyhow, I've already figured out what went wrong, and it just happened to be caused by data binding with change events that fiddled with the data binding, ultimately killing all commas added :p
Legendary Pirate
well im sure everyone would like to see the problem too so that no-one else makes the mistake. Do you mind sharing?
Ryan Guill
The problem was that I had a data provider that was linked with another block of code written by someone else that fiddled with parsing, and had the strange behaviour related with commas :p
Legendary Pirate