Forums Register Login

maxlength for customer id column

+Pie Number of slices to send: Send
Hi Everyone,

I would like to limit the number of string that can be entered in the customer id field. In this case, i will only allow 8 characters since this is what the urly bird specification requires. ANy thoughts on how I can implement this one?

regards,
tim
+Pie Number of slices to send: Send
In your create and update methods you could compare the length of the String provided against the metadata for each field.

Then if a field is too long you can either throw an exception or you could choose to truncate the string, i.e only insert the x leftmost characters.

Jason.
+Pie Number of slices to send: Send
Why not have an InputValidator class and restrict the length. This way, you only need to do it in one location, not in every SQL statements
+Pie Number of slices to send: Send
Have you looked at what formatted text fields can do for you? Especially the javax.swing.text.MaskFormatter class?

Regards, Andrew
+Pie Number of slices to send: Send
Hi Everyone,

I'm sorry about the confusion. I am entering the customer id in the cell in the table. So i do not think Maskformatter will help me. So I am wondering if there is something in the cell that can limit the number of characters you can enter.

regards,
tim

Originally posted by Andrew Monkhouse:
Have you looked at what formatted text fields can do for you? Especially the javax.swing.text.MaskFormatter class?

Regards, Andrew

 
+Pie Number of slices to send: Send
Any thoughts on how to implement this one?
+Pie Number of slices to send: Send
Hi Tim,

I have condensed Sun's TableFTFEditDemo into what is possibly the smallest bit of code that I can use to discuss this - it creates a simple table where the third column will only allow integers between 100 and 999 to be entered.

See how you go with this and/or see how you go with Sun's tutorials on the subject.

If in doubt, you can always come back and ask questions

Regards, Andrew
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1360 times.
Similar Threads
How to return nicely?
What's this meaning?
Bodgitt and Scarper GUI requirements
Newbie validation with textfile
not getting what this servlet is doing+MVC
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:45:24.