Page 1 of 1

Field format for unsigned ints

PostPosted: Wed Apr 06, 2011 12:35 am
by nromeou
Hi everybody,
I would like to have a text field with some format that would accept only unsigned ints.
Does somebody know how to do this??
I feel is much better than using a onDataChange validation.

Thanks for the help

Cheers

Re: Field format for unsigned ints

PostPosted: Sat Apr 09, 2011 7:21 am
by sbutler
You might want to try using a column converter instead. You can just change the sign so that its always positive.

Or if you must have it as a format, maybe something like this as the format:
Code: Select all
#;INVALID


The ; should separate the format so left side is positive values and right side is negative, so you just display something in there so the user knows its bad input. I haven't tried it, but that is a valid java DecimalFormat.

Another option might be to combine the format with a column converter. So if you assign the format of "#;#" then java should leave off the minus sign "-" on the negative value, so it will always look positive in the field. Then use the column converter to actually make it always positive.

Re: Field format for unsigned ints

PostPosted: Fri Apr 15, 2011 7:43 pm
by nromeou
Thank you Scott, it worked like a charm.

Re: Field format for unsigned ints

PostPosted: Wed Feb 20, 2013 2:18 am
by maria.kyselova
goldcougar wrote:You might want to try using a column converter instead. You can just change the sign so that its always positive.

Or if you must have it as a format, maybe something like this as the format:
Code: Select all
#;INVALID


The ; should separate the format so left side is positive values and right side is negative, so you just display something in there so the user knows its bad input. I haven't tried it, but that is a valid java DecimalFormat.

Another option might be to combine the format with a column converter. So if you assign the format of "#;#" then java should leave off the minus sign "-" on the negative value, so it will always look positive in the field. Then use the column converter to actually make it always positive.


That was helpful, thanks.