• Post Reply Bookmark Topic Watch Topic
  • New Topic

Enable editing in a text field after a specific point

 
Lila Fowler
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.

I'm trying to get a text field to only be editable after a certain point eg: after x amount of characters.(after the xmlChar value)

Eg: Please insert value: xmlChar78998WJJHY

(xmlChar --> is auto-inserted via xml the user should not be able to delete or edit this value)
(78998WJJHY --> any value that the user inserts after the xml value)

Here's the relevant code, i don't really have any idea how to do this in a text field as string methods like
xml.charAt();
xml.indexOf(); arn't available for text fields.

Any suggestions would be appreciated thanks=)

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> (xmlChar --> is auto-inserted via xml the user should not be able to delete or edit this value)

put 'xmlChar' in the border
 
Lila Fowler
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry but i don't really understand what you mean by put it in the border --> what border?
Thanks
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably what you can do is, just before the textfield put a label which displays the non-editable text.
 
Lila Fowler
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be done as part of the text field due to the fact that all the gui's are done dynamically so there isnt a static label that i can create for only that one field. Also the whole value will have to be save into the database once the user presses ok.
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There need not be a static label. You can always set your dynamic text to the label field it self. As far as saving the value is concerned you can always concat the two strings.
 
Rob Camick
Ranch Hand
Posts: 2700
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a more complex solution you can use the Protected Text Component.

For a simpler solution you can use the following, but in this case you will not be able to "select" the prefix:


 
Lila Fowler
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob that was exactly what i was looking for
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!