Announcement

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

    About DateItem

    Hi All:
    For dateItem, I have some issues to be resolved:
    1. can dateItem set to be accept null defaultValue, means while it's create, draw or show, it's defaultValue is null(not things to be showed.)

    Thx.

    #2
    A DateItem with useTextField set allows null as an initial value.

    Comment


      #3
      the if the DateItem not using Textfield?

      Comment


        #4
        The DateItem does not support a null value unless it has useTextField:true.

        Comment


          #5
          if useTextField: true, and if this field has value, then clear it, how to update to DB?
          for example, the original value: 01/01/2007, then modified it to "", how to udpate to DB to ""??

          Thank you!

          Comment


            #6
            You should find that you ultimately receive a "null" value for the field on the server. Check the server-side logs to see this value as part of the printing of the request object.

            Comment


              #7
              I cannot seem to clear a DateItem with setUseTextField(true) having a setDefaultValue. When the form is submit, the defaultvalue is inserted again and that value is sent to server.
              A defaultvalue is required, but a value is not: setRequired(false). So it should be possible for a user to clear that value.

              Comment


                #8
                hello,

                I use DateItem and UseTextField

                DateItem minMajItem = new DateItem();
                minMajItem.setUseTextField(true);
                Date date = new Date(2008,01,01);

                minMajItem.setDefaultValue(date);

                But my date is not apply, current date it's apply

                I don't undestand

                Comment


                  #9
                  Bumping this thread

                  Also, how to define the current date as defaultValue inside a ds.xml file?

                  reason is I have a lastupdatedAt field and createdAt field that should in some cases be set as now() using mysql

                  Do I need to set operationBinding for that?

                  If so how to set the current date?

                  Does this operationBinding feature require Power or EE edition?

                  Comment


                    #10
                    We're not showing an issue with setDefaultValue() establishing a defaultValue.

                    When you have a defaultValue, setValue(null)/clearValue() will reset to this value. If you want to initialize the field to an initial value once ever, call setValue(), not setDefaultValue().

                    There are convenience FieldTypes for storing the creation or modification date. You can also do this with an operationBinding that declares a DMI (in Pro).

                    In Power and above, you could also do this with a tag in the operationBinding like:

                    Code:
                    <operationBinding ... >
                         <values fieldName="someField" value="$transactionDate"/>
                    This is the Transaction Chaining feature, also shown here.

                    Comment


                      #11
                      Awesome reply.

                      Very well detailed.

                      In my case I have a date field, not a date time, but I could easily change it if necessary to DATETIME

                      I guess the convenience fields for my situation is more than perfect

                      The field I am looking at is most likely CREATORTIMESTAMP

                      But how should I define this inside ds.xml?

                      Or would I have to make the field hidden and programatically set it in Client GWT java code?

                      Cheers,

                      EJ

                      Comment


                        #12
                        Just use:

                        Code:
                        <field type="creatorTimestamp" ..
                        For modification timestamps it's "modifierTimestamp".

                        These two strings aren't completely clear from the docs, we'll correct that.

                        Comment


                          #13
                          Thank you very much.

                          Very much appreciated

                          Cheers,

                          Ernani

                          Comment

                          Working...
                          X