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

Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified
Accepted Solution

check data empty in EditField.



I created several EditField for gethering address like addr, city, state and zipcode.

I want to give some alert without moving next field if user dodn't fill out the field.


Is there anyway for this feature?




Posts: 445
Registered: ‎07-15-2008
My Device: Not Specified

Re: check data empty in EditField.

Try this:



EditField ef = new EditField("Text: ","<data>"); String s = ef.getText(); if (s.equals("")){ //if the EditField does not contain data }else{ //it does contain data }


 Check for that at: onClose()




If your question was answered, please accept it as a sollution and / or give Kudos ;-)
Use the Search Field first! Maybe the question you want to ask already exists!
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: check data empty in EditField.

I suggest you override onUnfocus() to do this.


Unfortunately this doesn't stop anyone "submitting" immediately without going through your protected fields, so I have never bothered with this.  It is also incredibly annoying if you really want to fill out the screen in a different order than they are displayed.  Instead, I do the 'not empty' checking as part of the submit process.  But that is just me......