PDA

View Full Version : Determining position of text in input field



gib65
11-01-2017, 08:59 PM
Hello,

I'm creating a customized search input field that takes text on the left side and search tags on the right:

6218

I want to limit the text to whatever will fit into the left side such that the user cannot type into the space occupied by the tags. For example, in the image above, the user can type:

"This is some text. This is more text. Man, there's a lot of text here. Just look"

before hitting the left-most tag "MECXXX". At that point, I want to prevent the user from typing anymore.

But if the user gets rid of the "MECXXX" tag, he should be able to type some more:

"This is some text. This is more text. Man, there's a lot of text here. Just look at all this text"

6219

I can figure out the position of the left edge of the left-most tag, but how do I figure out the position of the right edge of the text?

jscheuer1
11-02-2017, 03:16 PM
I think that you will just have to use trial and error to determine the max number of characters that will fit in each situation and have your code set the maxlength attribute of the text field accordingly.