TextField + NumericTextFilter = IllegalArgumentException

Hello

I have a text field with a NumericTextFilter

net.rim.device.api.ui.component.TextField t = new TextField();

t.setFilter (new NumericTextFilter());

Let me do not allow inserting non-numeric characters, instead, when I press on a tank that is not a number, I get an IllegalArgumentException. Can you tell me how I can solve this problem?

Thanks in advance.

Kind regards

Gianni.

So you say that when your username is centered on an EditField with this standard TextFilter in place, and they type an alphabetic characters, and not a numeric characters, your program gets an IllegalArgumentException?

To be honest I find it hard to understand.  In all cases where use filters, the invalid keystrokes are ignored.

What I think is happening, is that you are trying to fill this field with data, so that your setText (...) is failing in this way.  As your user, when you try to put data in this area should be matching the filter.

Tags: BlackBerry Developers

Similar Questions

  • Numbers in the textfield using the Boolean and structure of the case?

    Hello!

    I am very new to these forums and LabVIEW in general. I am currently trying to implement a calculator-ish, but without the operations (+ - * /).

    I have 10 Boolean buttons named 0-9, and with them I want to basically write a sequence of numbers in a textfield. I managed to solve the problem using a structure of the event, but now I would get the same result using a case instead of this structure. The problem is that I can't identify which button was pressed, so I can't make the program go to the proper case (0 to 9). Is there a simple solution to what you guys could help me with? Perhaps a property node that is generic for each button? I do not know

    in any case, I enclose you a simplified version of what I am seeking to achieve, withouh code I do not know how to write of course.

    Thanks for your help in advance!

    / Sebastian

    Here's a way to do it: combine Boolean values in a table, which become an 8-bit number and which thread to a structure to deal with a Boolean radix

  • Application closes when you write in the TextField

    Hello

    I was announced an update of my application on the site of the seller with the help of Air 3.5 and I return this error report:

    "BlackBerry Z10, Q10 of BlackBerry and BlackBerry Z30 when I fill the empty text box, the application closes by itself."

    The textfield in question is a standard than as3 Textfield value ENTRY. I can't reproduce the problem in the simulator of 10.2 and I don't have a real device. Is this a known issue?

    Duplicate: http://supportforums.blackberry.com/t5/Adobe-AIR-Development/Flash-apps-crashing-in-10-2-when-input-...

  • Waterfalls in the TextArea or TextField bug

    TextArea or TextField has slot as onTextChanged (QString string). If I put a symbol '. 'or', ' before the text in the input field, then when this slot will trigger, the text parameter will be empty string. I think it's a bug. Version of the sdk is 10.2. Have someone has experienced this problem and how can I solve this problem?

    Welcome on the support forums.

    You can file bugs in jira:
    https://www.BlackBerry.com/JIRA/secure/dashboard.jspa

  • Always visible hint of TextField

    Hello together,

    I'm trying to get an entry as in the blackberry calendar application when adding an appointment. The indication "subject" is displayed on first use and after comments is displayed at the top:

    Initial state:

    After the entry

    How can I achieve this? I'm a little stucco here.

    Thanks for help you .

    Sven

    Given that hintText works oddly, it is a prototype of bad

      Label {
          id: myTextHint
          visible: myText.text.length > 0
          bottomMargin: 0
          translationX: ui.du(2)
          textStyle.color: Color.create("#999999")
      }
      TextField {
          id: myText
          hintText: "Subject"
          backgroundVisible: false
          onTextChanging: {
              myTextHint.visible = text.length > 0
              myTextHint.text = hintText
          }
          bottomMargin: 0
          topMargin: 0
    
      }
      Container {
          preferredHeight: 1
          horizontalAlignment: HorizontalAlignment.Fill
          background: Color.LightGray
      }
    
  • username (textfield) must not be empty

    Hi all...

    Can someone tell me how to print an error message (qml or c ++) when a user leaves a field blank IE user name or password.

    pls help me I've tried so many things, but not successful...

    check for textfield.text.length
    a joint systemdialog to view the message (qml). to use which adds "import bb.system 1.0" to the qml file.

  • TextField: begin the text to lowercase

    Is it possible to configure a TextField element to begin with a lowercase character without changing its inputMode?

    Well, I found this:

    TextField {}

    Input.Flags: TextFieldFlags.AutoCapitalizationOff

    }

  • How to increase the size of the font of the TextField?

    Hi everyone, one question seems stupid, but I found no solution. I have a TextField and I want to increase the size of its police, but I can't. Looks like it has a maximum default font size, I can not change, the largest size of it seems to be 15pt, but I want to double this size. I have recently become familiar with developing applications on the BB, I think some of them the real problem is stupid, please help me, thank you very much.

    TextField {}

    ID: tx

    clearButtonVisible: false

    Input.Flags: TextInputFlag.VirtualKeyboardOff

    text: "ddddd".

    inputMode: TextFieldInputMode.Text

    preferredWidth: ui.du (60.1)

    preferredHeight: ui.du (60.1)

    textStyle.fontSize: FontSize.PointValue

    textStyle.fontSizeValue: 40.1

    {textFit}

    maxFontSizeValue: 100

    }

    }

    There is a very ugly way using scaleX and scaleY

  • IllegalArgumentException in PIMItem.getString (int, int)

    int[] intarray = cont.getFields();
    for(int x = 0; x < intarray.length; x++)
    {
        System.out.println(cont.getString(intarray[x],0));
    }
    

    This is just one example of code, but it throws the same exception is my real application.  Suite is a Contact object that I've initialized from the context object in the address book.  Whenever I get to the line getString, it throws an IllegalArgumentException for anything other than the constant of PIMItem.TEL despite the fact that other objects are not null.  I develop for the Blackberry 7290 with Handheld Software version 4.1 and JDE version 4.1.  Is there a reason that I'm getting this exception?

    EDIT: Sorry, Contact.TEL not PIMItem

    You don't want to read a string if it * is * a string.  Try something like:

    int[] intarray = cont.getFields();
    for(int x = 0; x < intarray.length; x++)
    {
        if (myPimList.getFieldDataType(intarray[x]) == PIMItem.STRING) {
            System.out.println(cont.getString(intarray[x],0));
        }
    }
    
  • How Textfield text on another page qml property access

    Hello

    I started 10 BB development recently and need help. I searched this forum but could not find some information exactly related to my problem (unlike only), or I missed something from basically. My main.qml, I want to access the text property of the textfield of the InputControl.qml to be used as a parameter in my SQLQuery (attached object). I tried to use the fieldname method alias property, but it does not work. I can't feature outside. Here is my code:

    hand. QML

    import bb.cascades 1.4
    import bb.cascades.datamanager 1.2
    import bb.system 1.0
    import bb.data 1.0
    
    Page {
    
        id: root 
    
        titleBar: UIControls {
        }
    
        //! [0]
       content: Container {
    
            leftPadding: ui.du(2)
            rightPadding: ui.du(2)
            topPadding: ui.du(2)
            bottomPadding: ui.du(2)
    
            InputControl {
            }
    
            // The ListView that's used to display the artist data
            //! [1]
            ListView {
                id: myListView
    
                //property variant dq: defaultDataQuery
                // Associate the list view with the data model that's defined in the
                // attachedObjects list
                layout: StackListLayout {
                    headerMode: ListHeaderMode.Sticky
                }
                layoutProperties: StackLayoutProperties {
                    spaceQuota: 1.0
                }
                horizontalAlignment: HorizontalAlignment.Fill
                verticalAlignment: VerticalAlignment.Fill
    
                listItemComponents: [
    
                    ListItemComponent {
                        type:  "item"
    
                        Container {
                            Label {
                                text: ListItemData.Japanisch
                                layoutProperties: StackLayoutProperties {
    
                                }
                                topMargin: 5.0
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Bold
                                    color: Color.create("#7a184a")
                                }
    
                            }
                            Label {
                                text: ListItemData.Lesung
                                textFit.maxFontSizeValue: 9.0
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                    color: Color.create("#ff1818e9")
                                }
    
                            }
                            Label {
                                text: ListItemData.Deutsch
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                }
    
                                multiline: true
                                textFit.maxFontSizeValue: 8.0
                            }
                            Divider {}
                        }// Container
                    }
                    // Use a standard list item to display the data in the model
                ]    
    
            } // end of ListView
    
        }//![1]
    
        attachedObjects: [
            //! [2]
            // One of the default provided DataModel's
    
            GroupDataModel {
                id: dataModel
                grouping: ItemGrouping.None
            },
            DataSource {
                id: dataSource
    
                // Load the data from an SQL database, based on a specific query
                source: "WadokuJT.db"
                //query: "select Japanisch, Deutsch, Lesung from WadokuJT where Deutsch like '%Wasser%'"
                query: "select Japanisch, Deutsch, Lesung from WadokuJT where Deutsch like '%" + stext + "%'";
    
                onDataLoaded: {
                    // After the data is loaded, insert it into the data model
                    dataModel.insertList(data);
    
                }
                type: DataSourceType.Sql
            } // end of DataSource      
    
        ]//! [2]  
    
        actions: [
            //! [8]
            ActionItem {
                title: qsTr("Search")
                imageSource: "asset:///images/ic_search.png"
                ActionBar.placement: ActionBarPlacement.Signature
                onTriggered: {
                    myListView.dataModel = null
                    dataSource.load()
                    //myListView.dq = defaultDataQuery
                    myListView.dataModel = dataModel 
    
                }
            },
    
            ActionItem {
                title: qsTr("Settings")
                imageSource: "asset:///images/ic_settings.png"
                onTriggered: {
    
                }
            },
    
            ActionItem {
                title: qsTr("Help")
                imageSource: "asset:///images/ic_help.png"
                onTriggered: {
    
                }
            }                           
    
        ]//![8]
    
    } // end of Page
    

    And here is my InputControl.qml

    import bb.cascades 1.4
    
     Container {
         property alias stext: txtSearchText.text
    
        Label {
            id: lblSearchText
            text: "Searchtext\r\n"
    
        }
    
        TextField {
            id: txtSearchText
            layoutProperties: FlowListLayoutProperties {
    
            }
            hintText: "Enter Searchtext"
        }
    }
    

    Any help is greatly appreciated. Thank you.

    Give InputControl an id (in main.qml), for example someId.

    Access the variable an alias like someId.stext

  • Push registration: (Berr java.lang.IllegalArgumentException) network error

    Hello

    We try to get WebWorks push the work but are a problem with blackberry.push.openBISPushListener. The onRegister function returns a status of 1 (network error).

    The log file shows the following:

    11/9 10:00:54 W net.rim.blackberry.api.push - Berr java.lang.IllegalArgumentException
    11/9 10:00:21 a Contapp - PushDaemon is started.
    11/9 10:00:21 a Contapp - Register push application
    11/9 10:00:21 a Contapp - open BIS push listener
    

    This application is used to work so I wonder if something might have changed in the upgrade of the server push.

    The application code is the following:

    
    
    
        
    
    
        

    And the following push configuration in the config.xml file:

    
    
    
    
    
    
    
    
    
      BIS-B
      MDS
      TCP_WIFI
      TCP_CELLULAR
      WAP2
      WAP
    
    
    
      read_device_identifying_information
      access_shared
    
    

    It is all tested on a device 9300.

    Any ideas as to why we get this error?

    Thanks in advance for the help!

    Nick

    This issue should now be resolved, please let me know if you continue to have problems with the registration with the EVAL server.

  • problems with application to a textfield focus

    It comes to the page, what am I doing wrong?

    import bb.cascades 1.0

    {Page}
    ID: addPage
    appScene variant property: Application.scene
        
    Signal custom to notify that this page should be closed
    signal is)
        
    title bar: title {} bar
    Title: qsTr ("Add Location") + Retranslate.onLocaleOrLanguageChanged
    dismissAction: {ActionItem}
    Title: "Cancel".
    onTriggered: {}
    The custom here signal to indicate that this page should be closed
    The signal would be treated by the page that invoked it
    addPage.done ();
    }
    }
    }
        
    {Of container
    background: Color.Transparent
    TextField {}
    ID: cityfield
    hintText: qsTr ("enter city or Postal Code") + Retranslate.onLocaleOrLanguageChanged
    inputMode: TextFieldInputMode.Text
    input.submitKey: SubmitKey.Search

    }

    }
    onAppSceneChanged: {}
    This triggers the update if the stage of the application is set to
    This Page QML.
    cityfield.requestFocus ();
    }
    }

    Do you want the text field to get the focus (and pull up the virtual keyboard on Z-devices) as soon as the page is loaded?

    Try to create a property on the qml page:

    property bool showVKB: false
    

    And add this method in your qml:

     onShowVKBChanged: {
            if (showVKB) {
                // This focus request shows the VKB if the Page is created via a ComponentDefinition (see main.qml)
                tfWord.requestFocus();
            }
        }
    

    And then, in your qml page that drives this page, set the showVKB property:

    navigationPane.push(page);
    page.showVKB = true;
    
  • TextField uppercase in QML

    How can I set the textfield object to control all text entries in the field are UPPERCASE? Thank you!

    TextField {}
    ID: plutextfield
    text: 'TEST '.
    textStyle.fontWeight: FontWeight.Normal
    textStyle.fontSizeValue: 12.0
    textStyle.lineHeight: 2
    textStyle {}
    Base: SystemDefaults.TextStyles.BodyText
    textAlign: TextAlign.Right
    }
    }

    TextField {}
    onTextChanging: text = text.toUpperCase)
    }

  • How know or identify a centered TextField?

    I can't know the property targeted for the TextField or TextArea can then, what can you help me

    To determine if the control focuses:

    http://developer.BlackBerry.com/Cascades/reference/bb__cascades__control.html#property-focused

    To request the update:

    http://developer.BlackBerry.com/Cascades/reference/bb__cascades__control.html#function-requestFocus

  • Tests of TextField

    Hello

    Can someone tell me what I'm doing wrong here?  I want text large enough to read, but it's true lower case.  I'm just playing make a primitive text editor and I started with the code in the page Web Adobe FileReference.

    package {
        import flash.display.*;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.net.FileReference;
        import flash.net.URLRequest;
        import flash.net.FileFilter;
        import flash.text.*;
        import flash.text.TextFormat;
        import flash.text.TextFormatAlign;
    
        [SWF(height="600", width="1024", frameRate="30", backgroundColor="#ffffff")]
        public class EditFile extends Sprite {
    
            private var MyTextField:TextField = new TextField();
            private var MyButtonField:TextField = new TextField();
            private var MyFile:FileReference = new FileReference();
            private var C_format:TextFormat = new TextFormat();
    
            public function EditFile() {
    
                C_format.bold = true;
                C_format.size = 40;
    
                MyTextField.border = true;
                MyTextField.width = 700;
                MyTextField.height = 450;
                MyTextField.setTextFormat(C_format);
                MyTextField.multiline = true;
                MyTextField.type = TextFieldType.INPUT;
    
                MyButtonField.background = true;
                MyButtonField.backgroundColor = 0x339933;
                MyButtonField.x = 850;
                MyButtonField.y = 120;
                MyButtonField.height = 30;
                MyButtonField.text = "Click here to save";
    
                addChild(MyTextField);
                addChild(MyButtonField);
                MyButtonField.addEventListener(MouseEvent.CLICK, clickhandler);
                stage.nativeWindow.visible = true;
    
            }
    
            private function clickhandler(e:MouseEvent): void {
                MyFile.save(MyTextField.text);
            }
    
        }
    }
    

    Another thing cute is my cursor keys work (sort of) in the TextField, even if it does not exist on the keyboard of the pop-up window (maybe it should be?).  The mouse can select text, but not to change the insertion point as the cursor keys can.

    Thank you

    Harry

    Hey harry,.

    change this line:

    MyTextField.setTextFormat(C_format);
    

    This line:

    MyTextField.defaultTextFormat = C_format;
    

    that should do the trick even if I can't use my keyboard on my laptop for some reason any... works only if I type with the integrated keyboard.

    Edit: I forgot to put the explanation hah... defaultTextFormat property applies the format of text of w/e tell you him AGAIN all text entered in the field. the setTextFormat method applied the text of w/e format that say you the CURRENT text in the field.

Maybe you are looking for