How To Validate The Maximum Allowed Number Of Characters In A Multiline TextBox
Mar 30, 2010
I have a PDF document with a number of text fields, several of which have a maximum length - namely, a maximum number of allowable characters. Is there a way using iTextSharp to determine this setting? Here's the code I have so far:
Dim reader As New iTextSharp.text.pdf.PdfReader("Foobar.pdf") Dim inputFields As IDictionary(Of String, iTextSharp.text.pdf.AcroFields.Item) = reader.AcroFields.Fields For Each key As String In inputFields.Keys Dim PDFFieldName As String = key Dim MaxFieldLength As Integer = ??? ... Next
I need to set MaxFieldLength to the number of allowable characters for the current form field being iterated over.
1) Is it possible, in a multiline textbox, to automatically break to the next line after 100 characters? 2) If not, is it possible to parse the enter key as entered by the user to break the line in the code behind?
Some additional info:
The person requesting this does not think that the user should use a single line textbox limited to 100 characters and click an "Add Line" button to store that field in a table.
The person requesting this is of the belief that a DEC Alpha-based system that currently does this can be replicated on the web.
On my current form I have it validating a Canadian Postal Address (xxx xxx). The space is optional but if the user does not use a space, then once the validation passes it will insert one. How can I count the first 3 characters of the textbox, insert a space, then add the rest of the characters?
I couldnt help but notice that if you have a FileUpload-control, and then try to upload a file thats bigger(in bytes) then the allowed maxiumsize, then the site crashes or some wierd "Connection problem"-page shows up, atleast for me in Firefox...
So my question is simply...is this just for me?..and if not, how do I fix this the best way?...cause the current "crash-page" aint a nice way of handeling the problem in my opinion...whould be much better to actually just show some custom-page that lets the user know that thier trying to upload a file thats way to big..
I've got a sql table, that just keeps getting more and more columns added. I optimize the db as much as possible, but am curious about how many fields a table can have, and if there is a way to check if I'm getting too much data per row?