Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 13
Registered: ‎01-18-2011
My Device: bold 9000
My Carrier: telkomsel
Accepted Solution

restriction word for username

hi, all. i need some help here Robot Happy

 

lets say i have a username field.

how to make it restrict some word for the registration.

example: admin, gm, moderator, etc.

 

tq Robot wink Robot Very Happy

Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: restriction word for username

Welcome to the Forums

I would say get the values using "getText()" and put a check for the values you want to be restricted by comparing. ( using equals() )
If you find the input value equal to any of the restricted value, halt the operation and prompt the user.

This Check should be the first step of your submit event of this form.

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Contributor
Posts: 13
Registered: ‎01-18-2011
My Device: bold 9000
My Carrier: telkomsel

Re: restriction word for username

hmmm, that works for single word

 

the problem is i want to restrict the field from consisting word "admin" or "gm"

 

ex: admin_blackberry, adminBB, gm_blackberry, gmBB, etc

 

tq Smiley Very Happy

Highlighted
Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: restriction word for username

hmmmm...
You can use:

 

if ((input.indexOf("admin") != -1) || (input.indexOf("gm") != -1))  {

//halt and prompt user

}

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Contributor
Posts: 13
Registered: ‎01-18-2011
My Device: bold 9000
My Carrier: telkomsel

Re: restriction word for username

works like charm  Robot Very Happy tq