EditField listener to check the length of the field

I have a phone field which is an editfield.

I could restrict entry to 10 digits in this field to hold mobile digital values.

But now I want to add an additional post that throws an error dialogue once the user typed a value less than 10 in this area.

This action must be triggered as soon as the user has typed something and went to the next field.

Here is my code:

LabelField lbl1 = new LabelField(" Phone No:            ");

       final EditField TextField2 = new EditField("", "", 10, 0)
       {
          //Some statements
       }
TextField2.setChangeListener(new FieldChangeListener()
        {
          public void fieldChanged(Field field, int context)
          {
              if(TextField2.getText().length() < 10)
                          System.out.println("Please enter a valid 10 digit mobile number!");
          }
        });

Help, please. Thank you.

As @simon_hain said, let me quote myself: "you must override the onUnFocus method.

protected void onUnfocus(){  if(getText() == null || getText().length() < 10)    Dialog.alert("Text too short!");}

Tags: BlackBerry Developers

Similar Questions

  • I'm figuring (add) a column on a PDF form and on the calculation tab, it doesn't let me select (check) the fields I want to calucalate.  It won't let me type in the fields of the box either.

    I'm figuring the shape (add) a column (sum) on a pdf file and on the calculation tab, it won't let me select (check) the fields I want to use in the calculation.  It won't let me type fields in the box either.  I'm doing something wrong?

    the mouse click on the name of the field and press the space key

  • EditField - cursor stuck in the field

    Hello

    I have an EditField which changes color on onFocus and onUnfocus.  What is strange, is that the slider 'stuck' in the EditField whenever I move (using the trackball) in the field.  I am not able to move out of the EditField until I hit the ESC key.

    Anyone know why this is the case?

    I don't think that it has nothing to do with the definition of the properties available to the field, as all my EditFields behave this way when their "onFocus" and "onUnfocus" attributes are defined.

    (Code pasted below)

    EditField searchtextbox = new EditField(Field.FIELD_VCENTER) {
        public void layout(int width, int height) {
                super.layout(width, height);
                setExtent(250, 25);
                }
    
        public void onFocus(int direction) {
                Background activebgclr = BackgroundFactory
                    .createSolidBackground(Color.WHITE);
                setBackground(activebgclr);
                invalidate();
                select(true);
                }
    
        public void onUnfocus() {
                super.onUnfocus();
                Background inactivebgclr = BackgroundFactory
                        .createSolidBackground(Color.GRAY);
                setBackground(inactivebgclr);
                invalidate();
                }
    };
    

    When the focus is passed to the EditField, you use

    Select (true);

    This puts the ground in "selection mode, more usually used to select pieces of etxt for operations of cut and paste or copy.

    Delete this line and I think that things will work as expected.

  • How to check if the field is always get incremented by 1

    Hello all-

    This might be a very basic question. I'm just checking if a field is get incremented by 1 only. Here's my table structure:

    CREATE TABLE 'DIM_STAR_DAY '.

    (

    NUMBER of "DAY_DW_ID."

    "DAY."

    NUMBER OF "DAY_NBR_IN_EPOCH."

    NUMBER OF "DAY_NBR_IN_EPOCH_LY."

    NUMBER OF "DAY_IN_WEEK."

    NUMBER OF "DAY_IN_PERIOD."

    NUMBER OF "DAY_IN_QUARTER."

    NUMBER OF "DAY_IN_YEAR."

    CONSTRAINT 'PKDIM_STAR_DAY' KEY PRIMARY ("DAY_DW_ID") WITH THE HELP OF INDEX PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING STORAGE (INITIAL MINEXTENTS THEN 1048576 65536 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 USER_TABLES FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "MART_INDX" ENABLE

    )

    I want to check the field DAY_DW_ID should it still increased by 1 which corresponds to DAY field which means this condition should never happen, because these are two continuous days and day_dw_id should increase by 1 only:

    • Day_DW_ID DAY
    • 5964-4/26 / 2014
    • 5981 4/27 / 2014

    How can I write a query that gives me all these days where corresponding day_dw_id is higher than its previous day_dw_id 1. Thanks for your help and your answers. Very much appreciated.

    Hello

    This sounds like a job for the analytic LAG function:

    WITH got_prev_day_dw_id AS

    (

    SELECT d. *- or else

    AS trolling (day_dw_id) prev_day_dw_id (ORDER BY date)

    OF dim_star_day d

    )

    SELECT *.

    OF got_prev_day_dw_id

    WHERE day_dw_id <> 1 + prev_day_dw_id - or >

    ;

    This will display the rows where day_dw_id is greater than 1 higher to day_dw_id on the previous line (where 'previous' means 'in the order of day").  It also displays the rows where day_dw_id is less than 1 higher than the previous day_dw_id.  If you want to only include rows where the difference is greater than 1, then use > in the WHERE clause instead of <> .

    I hope that answers your question.

    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • JavaScript to remove the contents of the fields based on the checkbox disabled

    I'm writing a java script to delete the contents of the fields when a checkbox's checked to disabled.  I have a java script to fill in the field when the checkbox is enabled (which works perfectly).  But in the case where the user accidentally checks the field and wants to uncheck the box I would like the content of field that were initially filled from the first java script to be removed/disabled.

    Here is my code:

    Mouse Up Script for the checkbox (function() {}

    Do something if this check box is not selected.
    if(Event.Target.Value==="on") return;

    Copy the values from text previously filled in those other fields.

    getField("AP_Unit").value = Null;
    getField("AP_StreetAddress").value = Null;
    getField("AP_City").value = Null;
    getField("AP_Province").value = Null;
    getField("AP_ZIP").value = Null;
    getField("AP_Country").value = Null;

    })();

    Sorry it works... that make three equal signs "=" means?

    Here is my code

    If {(event.target.value==="Off)"}
    getField("AP_Unit").value =("");
    getField("AP_StreetAddress").value =("");
    getField("AP_City").value =("");
    getField("AP_Province").value =("");
    getField("AP_ZIP").value =("");
    getField("AP_Country").value =("");

    } else {}

    getField("AP_Unit").value = getField("HO_Unit").valueAsString;
    getField("AP_StreetAddress").value = getField("HO_StreetAddress").valueAsString;
    getField("AP_City").value = getField("HO_City").valueAsString;
    getField("AP_Province").value = getField("HO_Province").valueAsString;
    getField("AP_ZIP").value = getField("HO_ZIP").valueAsString;
    getField("AP_Country").value = getField("HO_Country").valueAsString;
    }

  • Check the data vacuum in EditField.

    Hello

    I created several EditField for gethering address as address, city, State and zip code.

    I want to give an alert without moving the following field if user big fill the field.

    Is there anyway for this feature?

    Thank you

    DK.

    I suggest that you override onUnfocus() to do this.

    Unfortunately this does not stop anyone 'submit' immediately without going through your protected fields, so I've never bothered with it.  It is also incredibly annoying if you really want to fill the screen in a different order, they are displayed.  Instead, I check the 'not empty' as part of the submission process.  But that's just me...

  • How to check the length of the string (from viewobject) attribute on jspx?

    Hello

    JDEV: 11.1.1.4

    I use the component of the carousel, inside, I use the Description attribute to display the content about to carousel,
    Now, I want to display a link as well, whenever the length of the description is longer than 150 characters.

    Currently backing bean that I am setting the property chklength to true or false, but the problem, the length is that I need a partial target
    and that's my Carousel component I get updated every time... is possible to check the length in page jspx itself inside the vissible property

    This is my code
    <af:outputText value="#{item.bindings.Descrip.inputValue}"
                                                             id="ot49"/>
                                               <af:commandImageLink text="more.." id="moreid" shortDesc="click to see more.." 
                                                                     visible="#{pageFlowScope.chklength}">
                                                <af:showPopupBehavior popupId="::p1"/>
                                                </af:commandImageLink>              
    Thank you
    Guillet

    You can try with # instead of $?

    visible = "#{FN: length (Item.Bindings.descrip.inputValue) > 150} '"

    Thank you
    Nini

  • Way to check the stats on listened to bit rate versions?

    Does anyone know if Flash Media Server has of a function which allows to display statistics on which particular streams is delivered?

    Seems this would be a handy tool to determine flow rates are important to continue to provide, and which are superfluous, and is it time to try encoding at higher bit rates.


    Thank you

    Mike

    You would like to check the access.00.log file to see what streams are made by FMS what time.

  • When you try to print, print poster page 6 instead of 1 page even when I checked the shrink for 1 box of page. Helps nothing in the layout.

    When I try to go to print preview a web page that should pring on 1 page only, it shows that it will take 6 pages to print the web page. In page layout, I checked the therapist to adjust the width of the page box. On my laptop, s print preview the page correctly - 1. Something needs to be adjusted, but I can't find the answer when I click on file/Page Setup. Help, please.

    See this:

    http://KB.mozillazine.org/Problems_printing_web_pages

    Shrink to Fit only affects the width of the content, not length.

    I think that your problem has to with the size of the paper selected in prefs printer via the button's properties. Probably an odd-ball small instead of Letter or A4 or a "custom" setting If it isn't, maybe that margins are set too large or margins are "b0rked" altogether and need to be reset.

    Try of the reset described here:

    http://KB.mozillazine.org/Problems_printing_web_pages#Reset_printer

  • astrophotography. I want to know that the focal length is to determine the field of vision?

    I'm interested in astrophotography.  I want to buy a camera for my telescope.  You can find the field of vision, if you know the focal length of the telescope.  But what is the focal length of a camera with a fixed lens?  If I have a 50 mm lens, is the focal distance 50 mm? or do you need to know the distance from the camera of body image sensor and add it to the lens focal length?  Thanks in advance...

    If you have a 50mm... lens focal length.  The focal length is the distance between the end of the lens and the image plane.  If you look at a digital SLR, there is a symbol on the body (usually the top of the body and often near the viewfinder) that looks like a small circle with a line through IT... which line marks the position of the focal plane inside the camera.

    There is a friction more... If you have a 'simple' goal, it would be the focal length.  Many modern lenses are technically able to be physically shorter than the focal length they provide... because of the types of 'glass' and the configuration of optics.  So the focal length is based on how long a simple goal should be to provide that same value (even if you were to physically measure it and not get this value.)

    All telescopes list their focal lengths, but also among the specs of the telescope focal reports.  I have a refractor of 540mm with an opening of 101mm... so it is 'roughly' f/5.4 scope.  I have also a larger 14 "SCT with a focal length of 3556mm and it is a stretch of f/10.

    The distance "flange to focal plane" on a camera Canon is 44 mm... in the grand scheme of things with a telescope, it will not substantially change the focal length of the image.

    Depending on the scope, you can use either a "focal reducer" or a "barlow" to decrease or increase the focal length.

    One last thing... many designs of 'Newtonian' type telescope is problematic for astrophotography.  This is because most of the glasses and catadioptric telescopes are designed with the intention that a person would use a diagonal of 90º with their eyepiece.  "The diagonal has a tendency to add"roughly"2" to the overal of the focal path length.  If you are using a camera you take this "diagonal" and simply attach the camera for a shot "straight through".  So even if you have lost the focal length 2 ", created by the diagonal... the camera adds"roughly"the same amount of back in.

    BUT... When you use a Newtonian telescope of reflector design, the eyepiece is near the front and there is no "diagonal" in use.  This means that when you add a camera, focal length gets longer, it would be with an eyepiece.    Pull door-eyepiece tube has some development trips... but because the camera is the longest focal length, you end up having to run the focuser completely 'in' to shorten the length of the focal length to put the image in focus.  And that's where you are having problems... very often on a Newtonian telescope, you exceed the limit of traction of focuser (you can't shorten the development any more that you have) and the image was just starting to focus... but it's still pretty fuzzy.

    This problem not to poison all the reflectors of knighting... some can accommodate cameras and still come to focus.  You really check the specific scope.

  • ASA 8.4 (6) "cannot retrieve or check the CRL.

    Hello

    I have configured our ASA to retrieve a list of Revocation provided through our Linux certification authority. The LCR is exported via Tinyca as a crl file and served by Apache.

    The file is accessible by the SAA and to date, I see an http 200 (OK). Despite this, I get an "impossible to extract or to check the Revocation list.

    The ASA is configured as follows:

    crypto ca trustpoint LINUX-CA-TP
    revocation-check crl none
    enrollment terminal
    crl configure
      policy static
      url 1 http:///issuingca.crl
      no protocol ldap
      no protocol scep

    Which allows to debug and try a "request for LRC crypto ca LINUX-CA-TP:

    ASA (config)# crypto ca crl request LINUX-CA-TP

    CRYPTO_PKI: CRL is being polled from CDP http:///issuingca.crl.

    Unable to retrieve or verify CRL
    vpn015pi(config)#
    CRYPTO_PKI: HTTP response header:
    HTTP/1.1 200 OK
    Date: Wed, 18 Dec 2013 12:49:01 GMT
    Server: Apache/2.2.22 (Ubuntu)
    Last-Modified: Wed, 18 Dec 2013 09:50:20 GMT
    ETag: ...
    Accept-Ranges: bytes
    Content-Length: 1170
    Connection: close
    Content-Type: application/x-pkcs7-crl

    CRYPTO_PKI: transaction HTTPGetCRL completed

    I'm a little puzzled. The error is not really tell where the ASA is exactly a failure!

    Thank you

    Hello.

    I know this is a late response, but I found the solution.

    My CA was created through openssl commands and LCR was coppied to the www server. I installed the CA ASA certificate and I tried to check the Revocation list. But he has failed. It's the debug output:

    CRYPTO_PKI: CRL is being polled from CDP http://x.x.x.x/ca/root-ca/root-ca.crl.crypto_pki_req(0x00007fff2b9e3900, 24, ...)CRYPTO_PKI: Crypto CA req queue size = 1.Crypto CA thread wakes up!CRYPTO_PKI: http connection openedCRYPTO_PKI: content dump count 81----------CRYPTO_PKI: For function crypto_http_sendGET /ca/root-ca/root-ca.crl HTTP/1.0Host: x.x.x.x
    
    CRYPTO_PKI: For function crypto_http_sendCRYPTO_PKI: content dump-------------------
    
    CRYPTO_PKI: HTTP response header: HTTP/1.1 200 OKDate: Wed, 13 Jan 2016 08:10:01 GMTServer: Apache/2.4.7 (Ubuntu)Last-Modified: Tue, 12 Jan 2016 10:12:50 GMTETag: "31c-529204bc05097"Accept-Ranges: bytesContent-Length: 796Connection: closeContent-Type: application/x-pkcs7-crl
    
    CRYPTO_PKI: CRL data2d 2d 2d 2d 2d 42 45 47 49 4e 20 58 35 30 39 20 | -----BEGIN X509 ...
    
    CRYPTO_PKI: transaction HTTPGetCRL completedCrypto CA thread sleeps!CRYPTO_PKI: Failed to retrieve CRL for trustpoint: ASDM_TrustPoint3. Retrying with next CRL DP...
    Because the CRL file has been downloaded, I check my LCR with the command openssl on my linux server:
    openssl crl -inform PEM -text -in crl/root-ca/root-ca.crl Certificate Revocation List (CRL): Version 2 (0x1) Signature Algorithm: sha256WithRSAEncryption Issuer:  Last Update: Jan 12 10:09:33 2016 GMT Next Update: Jan 11 10:09:33 2017 GMT CRL extensions: X509v3 Authority Key Identifier:  keyid:E9:5E:25:61:EB:5D:9D:7E:2E:1A:3A:DA:71:B3:7B:C2:55:8D:59:66
    
     Authority Information Access:  CA Issuers - URI:http://x.x.x.x/ca/root-ca/root-ca.cer
    
     X509v3 CRL Number:  1No Revoked Certificates. Signature Algorithm: sha256WithRSAEncryption...
    
    -----BEGIN X509 CRL-----...-----END X509 CRL-----
    I founded CRL file is in PEM format. And because another available in LRC format is DER format I have converted to DER format and copied to the www server.
    openssl crl -inform PEM -outform DER -in crl/root-ca/root-ca.crl -out crl/root-ca/root-ca-der.crl
    After that I tried to download file CRL my ASA again and he succeeded.
     CRYPTO_PKI: CRL is being polled from CDP http://x.x.x.x/ca/root-ca/root-ca.crl.crypto_pki_req(0x00007fff2b9e3900, 24, ...)CRYPTO_PKI: Crypto CA req queue size = 1.Crypto CA thread wakes up!CRYPTO_PKI: http connection openedCRYPTO_PKI: content dump count 81----------CRYPTO_PKI: For function crypto_http_sendGET /ca/root-ca/root-ca.crl HTTP/1.0Host: x.x.x.x
    
    CRYPTO_PKI: For function crypto_http_sendCRYPTO_PKI: content dump-------------------
    
    CRYPTO_PKI: HTTP response header: HTTP/1.1 200 OKDate: Wed, 13 Jan 2016 08:28:08 GMTServer: Apache/2.4.7 (Ubuntu)Last-Modified: Wed, 13 Jan 2016 08:25:54 GMTETag: "227-52932eb2c1926"Accept-Ranges: bytesContent-Length: 551Connection: closeContent-Type: application/x-pkcs7-crl
    
    CRYPTO_PKI: CRL data30 ...
    
    CRYPTO_PKI: Found suitable tpCRYPTO_PKI: Found suitable tpCRYPTO_PKI: Failed to create name objects to compare DNs. status = 1795CRYPTO_PKI(select cert) subject = ...CRYPTO_PKI: Found a subject match - inserting the following cert record into certListCRYPTO_PKI: Storage context locked by thread Crypto CA
    
    CRYPTO_PKI: inserting CRLCRYPTO_PKI: set CRL update timer with delay: 31455520CRYPTO_PKI: the current device time: 08:30:53 UTC Jan 13 2016
    
    CRYPTO_PKI: the last CRL update time: 10:09:33 UTC Jan 12 2016CRYPTO_PKI: the next CRL update time: 10:09:33 UTC Jan 11 2017CRYPTO_PKI: CRL cache delay being set to: 3600000CRYPTO_PKI: Storage context released by thread Crypto CA
    
    CRYPTO_PKI: transaction HTTPGetCRL completedCrypto CA thread sleeps!
  • I got the message "the u of typed password does not meet password policy requirements, check the minimum password, the password complexity and password history requirements" when changing password

    Original title: password problem

    When I try to write a new password on my windows ultimate 7, I received this message.

    "the u of typed password does not meet password policy requirements, check the minimum password length, password complexity and password history requirements"

    What can I do? I can't change my password :(

    Hi MedoXW,

    This means that you must create a password that meets all of the requirements

    1. make sure that the password is at least 6 to 8 characters.

    2. make sure that the password includes at least 1 capital letter, 1 number and a symbol as "!" or "$".

    3. make sure that the password is not one that you have used in the past.

    Follow all these rules and it should work.

    I hope this helps.

  • How to improve the custom rule by checking the existence of the role with INSERT permission?

    Hello

    following a custom rule to check the existence of some columns of audit - how can I improve this rule only to run for tables where there is a role with privileges to INSERT?

    Günter cordially

    function checkAudit (table) {}

    inserted_by = false;

    inserted_at = false;

    ruleMessage ="";

    tNom = table.getName ();

    If (tname.indexOf ('_DWH_') == - 1).

    {

    columns = table.getElements ();

    l = columns.length;

    for (var c = 0; c < l; c ++)

    {

    CNAME = columns [c] .getName ();

    If (cname == "INSERTED_AT") {inserted_at = true}

    If (cname == "INSERTED_BY") {inserted_by = true}

    }

    If (! inserted_at) ruleMessage = ruleMessage + not 'INSERTED_AT ';

    If (! inserted_by) ruleMessage = ruleMessage + not 'INSERTED_BY ';

    }

    If (ruleMessage! = "")

    Returns false;

    on the other

    Returns true;

    }

    checkAudit (table);

    Hi Gunter,

    the function to check if the column of table a insert privilege for role is less.

    It is possible insert are defined in table instead of the column - that does not check the function below.

    Philippe

    function hasColumnWithInsertForRole(table){
        sd = table.getRelationalModel().getStorageDesign();
        tp = sd.getStorageObject(table.getObjectID());
        if(tp!=null){
            roles = sd.getRoleSet().toArray();
            for(var i=0;i-1){
                    return true;
                }
            }
        }
        return false;
    }
    hasColumnWithInsertForRole(table);
    
  • Check the connection to a remote Oracle database


    Hello

    I have an application that runs on a server that connects to an Oracle database on another server.  The application uses Java and JNDI to connect, there is no Oracle client installed on the server hosting the application.  The application seems to have been to connect to the database on the other server.  How can I check that the connection to the database still work from the server hosting the application?  Is there a software tool that I use does not require Oracle client must be installed.

    Thanks in advance

    Alanjo

    the connection request is saved in the file listener.log on the DB server

  • How to check the image source for the image which is losted?

    Hello world

    How to check the image source for the image which is losted?

    If the image source already exists, I can read the PlaceItem.file.fsName.

    But if remove the image of the source, read the PlaceItem.file.fsName will report the error: there is no file associated with this element

    Thank you

    If (app.documents.length > 0) {}

    var sourceDoc = app.activeDocument;

    sourceName = sourceDoc.name var;

    artItem =]

    for (i = 0; i < sourceDoc.pageItems.length; i ++) {}

    artItem [i] = sourceDoc.pageItems [i];

    If (.) TypeName artItem [i] == 'PlacedItem') {}

    If (.imageColorSpace [i] artItem == undefined) {}

    Alert ("the file is the link, but I don't know whether or not the source image is losted");

    }

    }

    }

    }

    Use try/catch to catch the error

    if (app.documents.length > 0) {
        var sourceDoc = app.activeDocument;
        var sourceName = sourceDoc.name;
        artItem = []
        for (i = 0; i < sourceDoc.pageItems.length; i++) {
            artItem[i] = sourceDoc.pageItems[i];
            if (artItem[i].typename == 'PlacedItem') {
                if (artItem[i].imageColorSpace == undefined) {
                    try {
                        var fname = artItem[i].file.name;
                        alert("file name: " + fname);
                    }
                    catch (e) {
                        alert("The file is linking ,but source image is lost");
                    }
                }
            }
        }
    }
    

Maybe you are looking for