Impose fixed length validation

I have an editfield to contain the entered PHONE number.

I would like to have a fixed length of 10 numbers (not more or less) entry

How can I achieve this?

This is my code for phone editfield:

//Add box next to field for containing input
       HorizontalFieldManager hfm1 = new HorizontalFieldManager();
       LabelField lbl1 = new LabelField(" Phone No:            ",10);
//Adding 10 here doesnt help

       final EditField TextField2 = new EditField()
       {
           boolean _drawFocus = false;
            protected void layout(int maxWidth, int maxHeight)
            {
                super.layout(Math.min(maxWidth, 300), Math.min(maxHeight, 20));
            }
          protected boolean keyChar(char ch, int status, int time)
                {
                if (CharacterUtilities.isDigit(ch) || (ch == Characters.BACKSPACE))
                {
                return super.keyChar(ch, status, time);
                }
               return true;
                }
}
 };
       TextField2.setBorder(BorderFactory.createRoundedBorder(new XYEdges(2,2,2,2)));
       hfm1.add(lbl1);
       hfm1.add(TextField2);
       add(hfm1);

Please guide. Thank you

If you don't want an initial value, you can use it like this:

final EditField TextField2 = new EditField(yourLabel, "", 10, 0); //0 means no style.

And, if you want to use your label separately:

final EditField TextField2 = new EditField("", "", 10, 0); //0 means no style.

E.

Tags: BlackBerry Developers

Similar Questions

  • Fixed length ActiveAutoTextEditField

    Hello

    I want to add ActiveAutoTextEditField of fixed length. I want the user must be able to enter only 15 characters. If he's trying to write more than that... error msg should popup.

    any solution?

    Thanks in advance

    Use the appropriate constructor:

    ActiveAutoTextEditField (label As String, String initialValue, int maxNumChars)

    maxNumChars - Maximum number of characters that the field can contain.

  • Divide a table of lines of fixed length column.

    Hi Experts,

    I need a help on the splitting of a column values for several lines by a fixed length. The value of column length is variable. I want to split by a fixed length and create a separate from that.

    for example, my table is like

    ID Desc

    ============

    1 ABCDEFGHIJKLMNOP

    2 QRSTUVW

    3 XYZ

    My desire to output should be like BY SPLIT WITH 5 characters long

    ID Desc SEQ

    ===============

    ABCDE 1 1

    1 SON 2

    1 KLMNO 3

    1   P              4

    QRSTU 2 1

    2 2 VW

    3 XYZ 1

    Thank you

    This will do...

    SQL > ed
    A written file afiedt.buf

    1 with t (id, dsc) until)
    2. Select 1, "ABCDEFGHIJKLMNOP" dual union all
    3. Select 2, 'QRSTUVW' from dual union all
    4. Select 3, 'XYZ' from dual
    5        )
    6  --
    7. end of test data
    8  --
    9. select id, level, substr (dsc, ((level-1) * 5) + 1, 5) as dsc
    10 t
    11 connection by prior id = id
    12 and substr (dsc, ((level-1) * 5) + 1, 5) is not null
    13 * and prior sys_guid() is not null
    SQL > /.
    ID LEVEL DSC
    ---------- ---------- -----
    1 1 ABCDE
    1 SON 2
    1 3 KLMNO
    1 4 P
    2 1 QRSTU
    2 2 VW
    3 1 XYZ

    7 selected lines.

    Note: it is not a good idea to use 'desc' as a column name, as it is a reserved, Word used to describe the table definitions.

  • How to set a fixed length scheme, composed of several documents of different types, with details of the header and footer in points 22 and 23, namely having 10 for 20 for detail header and 30 for the footer

    How to set a fixed length scheme, composed of several documents of different types, with details of the header and footer in points 22 and 23, namely having 10 for header, 20 for retail and 30 for the footer.

    Here is the sample file

    DDWTYBILL13092502572 1000000112\\NHLSFS\ORACLE\ORACLE\BILLING\VERIFY\ 2013/09/25 01:19:08 BILLEND

    DDWTYBILL13092502572 2000000212PRIVATE PRIVATE STY5572142 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT NNM DIMPHANA, CN, CELESTE NERINA 9 January 1964 TYG A2 DR OF PREEZ 5602181 63301345 TB731543 Suspect 91TB? (AC) EMPIEEM A2 Z03.0 05-AUG-201305-AUG-201324-SEP Z03.9 - 2013FEND 113,60 TYGERBERG HOSPITAL Ward

    DDWTYBILL13092502572 2000000312PRIVATE PRIVATE STY5572149 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNM DIMPHANA, CN, CELESTE NERINA 9 January 1964 TYG A2 DR OF PREEZ 5602181 63301345 TB731548 empyema GMP A2 Z03.9 05-AUG-201305-AUG-201324-SEP Z03.9 - 2013FEND 113,60 TYGERBERG HOSPITAL Ward

    DDWTYBILL13092502572 2000000412PRIVATE PRIVATE STY5572351 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT NNM DIMPHANA, CN, CELESTE NERINA 9 January 1964 TYG A2 DR OF PREEZ 5602181 63301345 TB731584 Suspect 91TB? EMPIEEM? CA Ward HOSPITAL TYGERBERG Z03.0 Z03.9 A2 05-AUG-201305-AUG-201324-SEP-2013FEND 113,60

    DDWTYBILL13092502572 2000000512PRIVATE PRIVATE STY5572352 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT NNM DIMPHANA, CN, CELESTE NERINA 9 January 1964 TYG A2 DR OF PREEZ 5602181 63301345 TB731585 Suspect 91TB? EMPIEEM? CA Ward HOSPITAL TYGERBERG Z03.0 Z03.9 A2 05-AUG-201305-AUG-201324-SEP-2013FEND 113,60

    DDWTYBILL13092502572 2000000612MAJOR MAJOR STY5577530 010700 INV 12ZTYG000009 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNS ZOZI, S, SIYAMBONGA 27 March 2010 TYG D3 DR MARCELIN 5602181 113799662 TB731663 lymphadenitis Ward D3 TYGERBERG HOSPITAL I88.9 Z03.9 07-AUG-201307-AUG-201324-SEP H1 - 2013MEND 58,52

    DDWTYBILL13092502572 2000000712MAJOR STY5577537 MAJOR 010700 INV 12ZTYG000009 06-AUG-20130000010472 STY STY 1100611006MGIT 91 NNS DLAMINI, N, SIMON TYG 9 October 1976 F1 DR WZESE 5602181 135524676 TB731666 Suspect Ward TB F1 TYGERBERG HOSPITAL Z03.0 Z03.9 H1 07-AUG-201314-AUG-201324-SEP - 2013MEND 58,52

    DDWTYBILL13092502572 30003034120000003032END

    You can create a nXSD the use of the Native Format generator and advanced search attribute is used to read values to a specific position and use it as the choice. You can find an example here

    http://docs.Oracle.com/CD/E11036_01/integrate.1013/b28994/NFB.htm#BGBBAJFD

  • Help with columns of FIXED LENGTH - using the command of the coil

    Hi guys,.
    I have a vision I try to be wound using columns of fixed length, and the spacing is off. Ive tried many things like specifying the width of the column before executing the query, using the command rpad, but nothing seems to work. I have the coil in a text file so that users to import this file into another system. I'd appreciate any suggestions. Thank you very much. What follows is the view:

    SELECT 'Employe_id', 'FIRST NAME', 'INITIAL', 'NAME', 'SUFFIX', ' TRAINING ', 'Class ID', 'Class ID', 'We', "make / model ', 'Cali', 'Barrell', 'Serial number', 'Qualification', 'Application', 'SCORE', 'Status', 'add a time', 'Add a record ID', 'Add a record Date', ' change record ID ',' save the modified Date ', 'RN' OF
    (SELECT
    Upper (RPAD (tbl. SSN, 10)) AS "Employe_id."
    UPPER (RPAD('',12)) AS "FIRST NAME."
    UPPER (RPAD('',1)) AS "ORIGINAL."
    UPPER (RPAD('',20)) AS "LAST NAME,"
    UPPER (RPAD('',5)) AS "SUFFIX."
    SUPERIOR (RPAD (to_char (QUALDATE, 'MMDDYYYY'), 8)) AS 'DATE OF TRAINING. "
    Upper (RPAD('P123',8)) AS "Course ID"
    Upper (RPAD('',6)) AS 'class ID ',.
    Upper (RPAD ('P', 4)) AS '' We. ''
    Upper (RPAD('',4)) AS ' make / model.
    Upper (RPAD('',4)) AS "Cali,"
    Upper (RPAD('',7)) AS "Barrell."
    Upper (RPAD('',15)) AS "serial number."
    Upper (RPAD('A',4)) AS "Qualification."
    Upper (RPAD('D',4)) AS "Application."
    TO_CHAR ((RAWSCORE/250) * 100, "fm000.00") "SCORE".
    Upper (RPAD('PASS',4)) AS 'Status. "
    Upper (RPAD('',8)) AS "add time"
    Upper (RPAD('',8)) AS "registration Add ID."
    Upper (RPAD('',8)) AS 'Record Date added',
    Upper (RPAD('',8)) AS "Record ID change."
    Upper (RPAD('',8)) AS "Date of registration of the change."
    ROW_NUMBER () over (partition by firearms_scores.ID_NUMBER QUALDATE desc order) rn
    OF FIREARMS_scores, TBL
    where scores.id_number = tbl.id_number
    and qualyear = "2010" and coursecode = "SA".
    order by employee_id)
    where rn = 1

    Hello

    You RPAD does nothing, because they are identical:

    SQL> SELECT NULL AS "Record Add ID",
      2         NULL AS "Record Add Date",
      3         NULL AS "Record Change ID",
      4         NULL AS "Record Change Date" FROM DUAL;
    
    R R R R
    - - - -
    
    SQL>
    

    Does not see why the leadership of the COLUMN should not do what you want. Maybe you forgot the quotes?

    SQL> COL "Record Add ID" FOR a18
    SQL> COL "Record Add Date" FOR a18
    SQL>
    SQL> SELECT NULL AS "Record Add ID",
      2         NULL AS "Record Add Date",
      3         NULL AS "Record Change ID",
      4         NULL AS "Record Change Date" FROM DUAL;
    
    Record Add ID      Record Add Date    R R
    ------------------ ------------------ - -
    
    SQL>
    

    PS: You probably shouldn't affect the width of a column that is smaller than the length of the header

    Concerning
    Peter

  • Fixed-length data output

    I have an obligation to produce a file of ASCI with Pub BI return fixed-length that can be imported into 3rd party applications. We used forms to use the CLIENT_TEXT_IO package to do that (see below). What is the best way to do bi using an rtf model? I saw a few mentions of XSL-text models, but could not find a reference sample.

    DECLARE in_file CLIENT_TEXT_IO. TYPE_DE_FICHIER;
    in_file: = CLIENT_TEXT_IO. FOPEN (loc_f_name, 'w'); / * Open the file * /.
    BEGIN
    FOR phoneloop in phonelist LOOP
    tmp_sbrs_id: = rpad(phoneloop.sbrs_id,8,'~');
    tmp_sbrs_last: = rpad(phoneloop.sbrs_last,18,'~');
    tmp_sbrs_first: = rpad(phoneloop.sbrs_first,13,'~');
    tmp_sbrs_middle: = rpad(phoneloop.sbrs_middle,11,'~');
    l_record: = tmp_sbrs_id |
    tmp_sbrs_last |
    tmp_sbrs_first |
    tmp_sbrs_middle |
    tmp_status |
    '~';
    l_record: = replace (l_record,'~ ',' ');

    CLIENT_TEXT_IO. Put_line (in_file, l_record);
    END LOOP;
    CLIENT_TEXT_IO. FCLOSE (in_file); / * Close the file * /.
    END;

    That is right. But this is not the point. The Office of BI Publisher CONTAINS the
    Generator model for Word, but it includes a little more while.

    The BI Publisher Desktop comes with SAMPLES and these examples also contain
    eText examples so you can look at them.

    You can also RUN these examples using also included 'Model Viewer '.
    You must

    (1) run the Model Viewer.

    (2) select the folder that contains the sample data and the model. On my system:
    C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\samples\eText templates\example1

    (3) select the XML (i.e. ts1) and model of e-text - a RTF file

    4) go to the bottom and select the output format "eText.

    (5) click on the 'treatment' to start

  • Fixed length binary type?

    I'm about to start on a database, with approximately 200 billion lines and 10 bytes of raw binary PKs I heard say that the fields of length fixed to allow more effective indexing, but I can't find a suitable type. MySQL has similar to the CHAR types BINARY and VARBINARY, and VARCHAR. Y at - it something like type BINARY in Oracle 10 g? Otherwise, any other suggestions as to what I should use?

    Fixed length fields are not more effective from the point of view of indexing as the fields of variable length (in versions of Oracle has published over the last 20 years, I don't vouch for earlier versions).

    Oracle is not a fixed length binary type. You use variable-length RAW format.

    In general, I'd be rather reluctant to have a binary value of the primary key in Oracle. At a minimum, which is going to be a pretty unique configuration. Worst case, various tools not necessarily manipulate RAW values well, so that you can experience problems down the line.

    Justin

  • Fixed length records using SQL

    Hi, using the following code in a file that generates an output file with a fixed length 300 characters of the lines.

    COIL C:\PHONE_SAMPLE. OUT;

    SET THE OFF POSITION;
    SET PAGES 0;
    SET ECHO OFF;

    SELECT RPAD(CONTACT_ID,15), RPAD(PHONE1,15), RPAD(PHONE2,15), RPAD(PHONE3,15), RPAD(PHONE4,15), RPAD(PHONE5,15), RPAD(PHONE6,15)
    rpad(CALLSEQ,6), rpad(NDCALLSEQ,6), rpad(LANG,3), rpad(FIRST,25), rpad(LAST,25), rpad(CONCODE,10), rpad(EMAIL,30), rpad(TXTMSG,20), rpad(WVEND,20),
    RPAD(APPTSTART,14), RPAD(APPTEND,14), RPAD(APPTTYPE,10), RPAD(APPTLOCTION,10), RPAD(Filler,1) | » \n "
    OF PHONE_SAMPLE;

    SPOOL OFF;

    After I run this I get my data and what follows below - my memory of end of line characters, and then 'selected 22 lines' - how remove the 22 selected lines. and stop at \n. Any help appreciated.
    Is this a command set that I'm missing?

    \n


    22 selected lines.

    Set feedback off

  • Limit the length of the text to a fixed length

    I need to limit the length of a text fiield at some length to prevent packing. I can substr to a certain number of characters, but I use a proportional font (Arial), and the length of the string varies depending on the characters in the string.

    The field is the invoice number on a doc to check to RTF. If the field Bill encapsulates, it moves other objects on the control document and verify the cause of big problems printing.

    Is there a way to limit the length of a text field to an actual length printed on the document? Or prevent the area of packaging? IE just trunc it to a fixed length?

    Put the domain into a single table cell, select the table, right-click on it, choose Properties from the table in the menu, select the cell, click on the Options button, text Wrap option unceck.

  • fixed length variable length column column

    Hello

    New to oracle IAM. Here's the query where column1 appears as a column of fixed length of 16 characters.

    SELECT char(column1,16), column2 of table

    Please let me know if there is a command in oracle to get a single field with a fixed length.

    I think you want the rpad function

    Change
    SELECT char(column1,16), column2 of table

    TO
    SELECT rpad(column1,16), column2 of table

    Kind regards
    Harry

  • sample sound recording fixed length

    Hello

    I am facing a problem that can lead to one of the two decisions.

    In this project, I raise a good analysis of 0, 5 s, and then record if it is a valid sample. But I don't know how can I make a 0.5 s real-time analysis.

    Because of this problem, I tried to record every 0.5 s triggered signals, to conduct an analysis in a saved wav file. But the registered samples I get do not all have the same length

    Help please

    Hugo Guerreiro

    You can use the VI sound aquire

  • Fixed-term validity of the authorized document

    Hello

    I deleted the certificate exam 1z0-007, 1z0-042, 1z0-043 and received from Oracle's OCA code successfully.

    For some reason any from now on, I am unable to fill the hands on the course of oracle to obtain a certificate of OCP. During this time, I wanted to come back to 1z0-048 (RAC).

    I checked with Oracle, control centre and confirmed that I can attend the review.

    But my question is, how long will my result valid for 1z0 - 042 to take the OCP certificate and certificate of oracle RAC, if I intend to fill the hands on the course a little later.

    Is it a fixed duration as to the validity of the authorized document.

    Answer please, so that I can make a plan to attend the exam 1z0-048 as soon as possible.

    Kind regards

    PSB says:
    Hello

    I deleted the certificate exam 1z0-007, 1z0-042, 1z0-043 and received from Oracle's OCA code successfully.

    For some reason any from now on, I am unable to fill the hands on the course of oracle to obtain a certificate of OCP. During this time, I wanted to come back to 1z0-048 (RAC).

    I checked with Oracle, control centre and confirmed that I can attend the review.

    But my question is, how long will my result valid for 1z0 - 042 to take the OCP certificate and certificate of oracle RAC, if I intend to fill the hands on the course a little later.

    Is it a fixed duration as to the validity of the authorized document.

    Answer please, so that I can make a plan to attend the exam 1z0-048 as soon as possible.

    Kind regards

    SS,

    There is no time limit as such for the exams that are passed, provided that they are not obsolete for some reason any. If this isn't the case, the examination and approval remains valid.

    According to the review link,.
    http://education.Oracle.com/pls/web_prod-PLQ-dad/db_pages.GetPage?page_id=186

    You must be either 10 g / 11g OCP or should participate in training before you could be rewarded by the certificate. Please note that you can write any review of any time, but the award of certification would occur only once you pass all the prerequistes of it. Being a SANDBOX, you can probably write the review, but the certificate be given whenyou will meet all the requirements. Then I suggest you to end your OCP or follow the 10g RAC training program before writing the review.

    HTH
    Aman...

  • Adobe update and fix the validation button broken in Dreamweaver CS6?

    The validation button is obsolete and showing this error: this document HTML5 control interface is deprecated. [HTML5]


    As what I found, it is that they say it's the new location for posting: http://html5.validator.nu/

    Is it possible to manually change this somewhere?

    I don't think that CS6 qualifies for other updates, since it is the 5 versions of the current version of the creative cloud (CC 2014.1.1).

    CS6 validation tool uses the W3C online validation service (the same one I use in Firefox Web Developer Toolbar) that's why we get the "out-of-date" warning message  Otherwise, the former W3C service works again - isn't it just great to date of HTML5 files.

    Nancy O.

  • fixed length text

    What is the best way to create a text file of width fixed a CFQUERY results? Total width of the file is 630 characters with lots of white space. This will be used for the EDI.

    Thank you.
    -Christopher c. Keeler

    Yes. I found the answer. I used a custom tag called FixedWidth I found on the web somewhere.

    I can post it here

    -Christopher c. Keeler

  • XSD fixed and right length delimited file

    Hi all

    Using the adapter file I wanted to write a fixed length of file and the generated but the generated file is just delimited file: the fixed-length file contains (e.g..

    ............ Name... Family name

    Instead of

    Name... Last name...)

    Any suggestion, how desire out possible by file adapter or change in XSD?

    Any help appreciated.

    Thank you

    SG_SOA

    Hello

    Thank you for using nxsd:padStyle = "no |" Chief | tail"nxsd:paddedBy =" "for example"

Maybe you are looking for

  • new star firefox bookmark location

    I have the new update of firefox.I was surprised to see the star to make a new bookmark moved further to the right on the screen.Is there a real reason for the change, or just to look at new and better?

  • Irregularities in time stamp

    LabVIEW: 8.2 Material: cFP-2120 (Compact Fieldpoint) I have a collection of embedded data VI who collects a row of data once every 5 seconds. At the start of the VI it synchronizes time with a time server the Fieldpoint NIST. Up to this point, he was

  • Sound on ASUS laptop

    When I play a video from the internet, it looks like the chipmunks. I tried all my services troubleshooting and did a restore. Still having the same problem. Help

  • VPN QOS Design

    I am currently looking into the design of a VPN over the internet with QOS for video and voice using ASA and 2811 routers.  Does anyone have stories or the configurations of the sample that I could look at to see if there is still a possibility? Than

  • error: "cannot find symbol" when you use String.getBytes (java.nio.charset.Charset)

    I have a very simple java class that uses String.getBytes (java.nio.charset.Charset). When I use loadjava, I get the error: "cannot find symbol" for this call. Any ideas on what could be the problem?Here is the full source:package mytest;java.lang.St