hi all, i wrote some code to check the length of textfields. as i have to save all into a DB, where i've got some varchar(10). the code i have allows you to type only 10 chars into the respective textfield, but my problem is, that if i paste a longer string into it (from clipboard), the textfields accepts it and while i try to save, i get a DB exception that a submitted value is too big. am thankfull for any help. aa.
yes it's happened when u paste at textfeild ....... if u dont need the word longer then 10 chars my logic is u have to put this code at the event of button
// tf is the veriable of textfeild String str = tf.getText(); int i = str.lenght(); if (i<10) { System.out.println("ok"); } esle{ System.out.println("again"); // you have to write under 10 // }
if u learn to break the rock .. next day u will be looking to Mountain.
thank you very much. although the java tutorial implementation would be much better as i did now, i chose the way of getting the stringbuffer length and check it before writing to the DB. it's not too proper, but it works for the moment! thx again.
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
a bit of art, as a gift, the permaculture playing cards