Friday, January 11, 2008

Max Length for Text Boxes

I know a while back that we had mentioned putting MaxLength values on all text boxes to prevent OverFlow Exceptions.

I would like to get opinions on certain Text Box values and what we could use as a MaxLength in these cases:

Common Dollar Figures: since these include a decimal sometimes they may require a larger MaxLength Correct? What do we think a typical MaxLength would be in this situation?

Integer Amounts: Since a MaxLength of 9 here and a MaxLength of 9 in a Currency field are different, this could cause for Overflow Errors. 999999999 (Overflow) is much larger than 999999.99 (No OverFlow) (MaxLength 9 TextBox example)

Percentage amounts? Im thinking 4 MaxLength but what do you all think?

Obviously in certain situations:

Question directed at Sidney Crosby: "How much money did you sign your contract for?" Would be at the programmer's discretion.

Thanks for reading!

Bills Fan Dave

2 comments:

glayla said...

Common Dollar Figures - I think that in this case it's good to get a sense of the expected range of values. Try to make the maxlength as small as possible and still make it reasonable for the user. You can sometimes go back to the client and get an idea of the highest value they would expect for that field.

This also goes for percentage - but really I don't see why you'd need more than 3 spaces in most situations.

hth ;)

Bills Fan Dave said...

Thank you Layla for your insight!

YIDHTYVM!