Menu

Use of the point instead of the comma

Help
sandra81
2005-06-01
2013-06-03
  • sandra81

    sandra81 - 2005-06-01

    Hello,

    Here is my problem: I use the ressourceBunddle for the management of the language (in French and English). When I am in French, I must use the comma for the float fields. I will wish to use the point. Is this possible?

    Thank you in advance for your help.

     
    • Henner Kollmann

      Henner Kollmann - 2005-06-01

      see http://jdbforms.sourceforge.net/UsersGuide/html/ch16s05.html

      Should work for numbers too.

      Regards
      Henner

       
    • sandra81

      sandra81 - 2005-06-03

      Thank you, it goes! I used dbforms.pattern.float = ### 0.#####.
      But in the text field which contains my float, it posts "float0". I would like that the field is empty, how to make?
      Thanks in advance !

       
      • Henner Kollmann

        Henner Kollmann - 2005-06-05

        You can use the nullField value property!

         
    • sandra81

      sandra81 - 2005-06-06

      I do not manage to make function with the attribute nullFieldValue.
      Indeed, in my form (insert new value) my text field always displays by default the value "float0".
      Here my code:
      jsp page:
      < db:textField styleClass="clsInputStyle" size="7" fieldName="price" pattern="float" nullFieldValue="0"/>

      ApplicationRessource.properties:
      dbforms.pattern.float=###0.#####

      I would like that it displays 0 or 0.00000

      Which error I made? Thank you very much for your assistance!

       
      • Henner Kollmann

        Henner Kollmann - 2005-06-06

        remove the  pattern="float" attribute!

         
    • sandra81

      sandra81 - 2005-06-07

      I am sorry, but I don't understand.
      The help says :
      "Many tags make use of the pattern attribute. For example,

          <dateField pattern="date"
         
      To set values globally for each type and language, you can define dbforms.pattern.timestamp dbforms.pattern.date etc. For Example:

      ApplicationResources.properties

      dbforms.pattern.date=yyyy-MM-dd
      dbforms.pattern.timestamp=yyyy-MM-dd HH:mm"

      so, I define float pattern in my ApplicationResource.properties (dbforms.pattern.float=##0.#####) and I use the pattern attribute in my text field tag (<db:textField pattern="float"  fieldName="price">).

      Result : I can use the point instead of the comma but in the field it appears the value "float0".
      If I remove the pattern attribute, it appears the value "0" but I can't use the point instead of the comma.

      I sought a solution but I did not find. I am sorry. I hope that you will be able to help me!

      Thank you very much !

       
      • Henner Kollmann

        Henner Kollmann - 2005-06-07

        And that's wrong. using the pattern attribute just overrides the global settings. So in your case the text date or float will be used as pattern to format the string.
        That can't work.

         
    • sandra81

      sandra81 - 2005-06-20

      Ok, so how do I have to make to use a point instead of a comma for the
      float in my text field when the locale is FRENCH?
      I tested with the DecimalFormatSymbols class but it doesn't work.
         

       
      • Henner Kollmann

        Henner Kollmann - 2005-06-20

        Create a frensh resource file and add a dbforms.pattern.double=##.## entry!

        Henner

         
    • sandra81

      sandra81 - 2005-06-21

      Hi Henner !

      I am sorry but can be that I express myself badly. But it is what I did since the beginning.
      I create a french resource file and add a dbform.pattern.double=##.## entry (or dbform.pattern.float=##.## entry).
      So I can use point instead of comma but in the field of my form it appears the word "double0" (or "float0").
      Do you understand me?
      I hope we will be able to find a solution.

      Thanks !
      Regards,

      Sandra

       
      • Henner Kollmann

        Henner Kollmann - 2005-06-21

        Could send me the current version of the page again?
        Could you try to debug?

        Henner

         
    • sandra81

      sandra81 - 2005-06-21

      Hi Henner,

      I send you my files :

      purchase_list_and_single.jsp
      -------------------------------------------
      <%@ page language="Java" import="java.util.*,java.io.*,java.sql.*,java.text.*"%>
      <%@ taglib uri="/WEB-INF/dbforms.tld" prefix="db" %>
      <html xmlns:db="http://www.wap-force.net/dbforms">
      <head>
          <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <db:base/>
          <title>New Purchase</title>
          <link href="my_dbforms.css" rel="stylesheet">
      </head>
      <body class="clsPageBody">
          <db:dbform multipart="false" autoUpdate="false" followUp="follow.jsp" captionResource="true" maxRows="1" tableName="alter_purchase">
          <db:header>
          </db:header>
          <db:body>
          </db:body>
          <db:footer>
          <table>
              <tr class="clsHeaderRow">
              <td><db:message key="formNew.supplier.displayname"/></td>
              <td><db:message key="formNew.product.displayname"/></td>
              <td><db:message key="formNew.quantity.displayname"/></td>
              <td><db:message key="formNew.price.displayname"/></td>
              </tr>
              <tr>
              <td><db:textField styleClass="clsInputStyle" size="30" fieldName="supplier"/></td>
              <td><db:textField styleClass="clsInputStyle" size="25" fieldName="product"/></td>
              <td><db:textField styleClass="clsInputStyle" size="7" fieldName="quantity"/></td>
              <td><db:textField styleClass="clsInputStyle" size="7" fieldName="price" pattern="double"/></td>
              </tr>
          </table>
          <table>
              <tr>
              <td><db:insertButton showAlways="true" styleClass="clsButtonStyle" caption="formNew.button.insert"/></td>
              </tr>
          </table>
          </db:footer>
          </db:dbform>
      </body>
      </html>

      ApplicationResources_fr.properties
      ---------------------------------------------------

      dbforms.pattern.double=##.##

      formNew.page.title.new=Cration d'un nouvel achat
      formNew.title.new=SAISIE DES ACHATS
      formNew.button.insert=Insrer
      formNew.supplier.displayname=Fournisseur
      formNew.product.displayname=Produit
      formNew.quantity.displayname=Quantit
      formNew.price.displayname=Prix pay

      Regards
      Sandra

       
      • Henner Kollmann

        Henner Kollmann - 2005-06-21

        Is your field defined as double?
        Could you add the same pattern dbforms.pattern.float=##.##?
        Are you shure that the resource file is loaded?
        Could you debug the DbBaseHandlerTag.getFormattedFieldValue method what's happening with your field?

        Thanks
        Henner

         
    • sandra81

      sandra81 - 2005-06-24

      Hi Henner !

      I studied the DbBaseHandlerTag.getFormFieldValue class. I think
      that the error comes from the method typicalDefaultValue(). I did
      not have time to correct it. I found a solution alternate in the
      method getFormFieldValue:
      String returnValue = getFormFieldDefaultValue();
                  if (returnValue.compareTo("double0") == 0)
                      returnValue = returnValue.substring(6);
                  return returnValue;
         
      If I have time I will try to correct the problem.

      Thank you very much for your assistance, that goes now!

      Regards
      Sandra

       

Log in to post a comment.