Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Allow negative values in FloatItem

    Hi,

    Is there any way to allow the user to enter negative values in a FloatItem?

    I need the field to allow both positive and negative values.

    Thank you

    #2
    Hi,

    Any updates on the above?

    It is urgent.

    Thank you,

    Comment


      #3
      Float fields allow negative values already. If you think otherwise please show a minimal, standalone testcase demonstrating an issue.

      Comment


        #4
        This issue only appears when validateonChange is set to true for the DynamicForm.

        A standalone case is still needed?

        Comment


          #5
          Yes. If it's trivially reproducible, then it's trivial to show a test case, right?

          Comment


            #6
            Below is the code of the test case.

            The issue is for Integer and Float Items.

            Thank you,

            Code:
            package com.test.floatitemtest.client;
            
            import com.google.gwt.core.client.EntryPoint;
            import com.smartgwt.client.widgets.form.DynamicForm;
            import com.smartgwt.client.widgets.form.fields.FloatItem;
            import com.smartgwt.client.widgets.form.fields.IntegerItem;
            import com.smartgwt.client.widgets.layout.VLayout;
            
            public class FloatItemTest implements EntryPoint
            {
            
                public void onModuleLoad()
                {
            
                    VLayout stack = new VLayout();
                    stack.setMargin(5);
                    stack.setMembersMargin(5);
                    stack.setWidth(1300);
                    stack.setHeight(800);
            
                    DynamicForm negativeNumbers = new DynamicForm();
                    negativeNumbers.setValidateOnChange(true);
                    
                    FloatItem fTest = new FloatItem();
                    fTest.setTitle("Test Negative Float");
                    
                    IntegerItem iTest = new IntegerItem();
                    iTest.setTitle("Test Negative Integer");
            
                    negativeNumbers.setFields(fTest, iTest);
                    
                    stack.addMember(negativeNumbers);
            
                    stack.draw();
                }
            
            }

            Comment


              #7
              I ran your testcase and it works just fine. See attached screenshot.

              In you other thread you indicated you were running on a really old version of SmartGWT. Upgrade to v1.2 and in future posts always mention which version of SmartGWT you are using.
              Attached Files

              Comment


                #8
                Hi,

                I downloaded the latest nightly build and I am still facing this issue.

                I am getting the warning if I write the minus sign when the item is empty and then when I write the number I get number followed by minus example: 2- and the error is still shown.

                Attached are the screenshots of the errors.

                Thank you,
                Attached Files

                Comment


                  #9
                  which browser(s)?

                  Comment


                    #10
                    Internet Explorer 7

                    It works fine in Firefox 3.5.2 and in Chrome 2.

                    In IE, when I press "-", the error icon and message come up and the cursor is before the minus.

                    Comment


                      #11
                      Now why didn't you post this information with your original post? It would have saved everyone some time.

                      In the future always post the version of GWT, SmartGWT and the browsers you're seeing an issue with.

                      Sanjiv

                      Comment


                        #12
                        "-" is not a valid negative number - so what were you expecting?

                        It doesn't always make sense to use aggressive validation that fires on every keystroke. In those circumstances, don't use it.

                        Comment


                          #13
                          Hi Isomorphic,

                          My problem is that I am not able to enter the negative value since when I press the "-" in order to enter -2, I get the error and the cursor comes before the "-" which prevents me of entering -2 and it comes as 2-.

                          Also, taking the cursor after the - to enter the 2 is not possible.

                          The only solution is to enter the number and then go to the start of the Item to enter the "-" which is not user friendly and will cause a lot of issues with the users of the application.

                          Thank you,

                          Comment

                          Working...
                          X