Announcement

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

    validator.dependentFields+applyWhen: dep. field not passed to serverCustom validator

    SmartClient Version: SNAPSHOT_v11.1d_2016-10-27/Enterprise Development Only (built 2016-10-27)

    Chrome on OSX El Capitan

    Hello, please modify the #fetchOperationFS sample like this:
    Code:
    isc.ListGrid.create({
        ID:"dsListGrid",
        width: "100%",
        height: "100%",
        minFieldWidth:80,
        autoFetchData: true,
        canEdit:true,
        dataSource: "supplyItem"
    });
    supplyItem.ds.xml :
    Code:
    <DataSource
        ID="supplyItem"
        serverType="sql"
        tableName="supplyItem"
        titleField="itemName"
        testFileName="/examples/shared/ds/test_data/supplyItem.data.xml"
        dbImportFileName="/examples/shared/ds/test_data/supplyItemLarge.data.xml"
    >
        <fields>
            <field name="itemID"      type="sequence" hidden="true"       primaryKey="true"/>
            <field name="itemName"    type="text"     title="Item"        length="128"       required="true"/>
            <field name="SKU"         type="text"     title="SKU"         length="10"        required="true"/>
            <field name="description" type="text"     title="Description" length="2000"/>
            <field name="category"    type="text"     title="Category"    length="128"       required="true"
                   foreignKey="supplyCategory.categoryName"/>
            <field name="units"       type="enum"     title="Units"       length="5">
                <valueMap>
                    <value>Roll</value>
                    <value>Ea</value>
                    <value>Pkt</value>
                    <value>Set</value>
                    <value>Tube</value>
                    <value>Pad</value>
                    <value>Ream</value>
                    <value>Tin</value>
                    <value>Bag</value>
                    <value>Ctn</value>
                    <value>Box</value>
                </valueMap>
                <validators>
                    <validator type="serverCustom" dependentFields="category">
                        <applyWhen operator="and">
                            <criteria>
                                <criterion fieldName="category" operator="equals" value="Adding Machine/calculator Roll"/>
                            </criteria>
                        </applyWhen>
                        <errorMessage>custom error message</errorMessage>
                        <serverCondition language="groovy">value.equals("Roll")</serverCondition>
                    </validator>
                </validators>
            </field>
            <field name="unitCost"    type="float"    title="Unit Cost"   required="true">
                <validators>
                    <validator type="floatRange" min="0" errorMessage="Please enter a valid (positive) cost"/>
                    <validator type="floatPrecision" precision="2" errorMessage="The maximum allowed precision is 2"/>
                </validators>
            </field>
            <field name="inStock"   type="boolean"  title="In Stock"/>
            <field name="nextShipment"  type="date" title="Next Shipment"/>
        </fields>
    </DataSource>
    Then edit a row which has category:"Adding Machine/calculator Roll", and change the units to something other than Roll.
    You'll see in the logs that the category value is not used for the applyWhen and so the validator is inactive:

    Code:
     === 2016-10-28 09:53:11,588 [83-2] DEBUG RPCManager - Processing 1 requests.
      === 2016-10-28 09:53:11,589 [83-2] DEBUG RPCManager - Request #1 (DSRequest) payload: {
          criteria:{
              itemID:1
          },
          values:{
              itemID:1,
              units:"Ea"
          },
          operationConfig:{
              dataSource:"supplyItem",
              repo:null,
              operationType:"update",
              textMatchStyle:"exact"
          },
          componentId:"dsListGrid",
          appID:"builtinApplication",
          operation:"supplyItem_update",
          oldValues:{
              category:"Adding Machine/calculator Roll",
              itemName:"Adding Machine Roll 57x57mm Standard",
              itemID:1,
              unitCost:0.41,
              SKU:"45300",
              inStock:true,
              units:"Roll"
          }
      }
      === 2016-10-28 09:53:11,589 [83-2] INFO  IDACall - Performing 1 operation(s)
      === 2016-10-28 09:53:11,589 [83-2] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
      === 2016-10-28 09:53:11,589 [83-2] DEBUG DeclarativeSecurity - DataSource supplyItem is not in the pre-checked list, processing...
      === 2016-10-28 09:53:11,589 [83-2] DEBUG AppBase - [builtinApplication.supplyItem_update] No userTypes defined, allowing anyone access to all operations for this application
      === 2016-10-28 09:53:11,589 [83-2] DEBUG AppBase - [builtinApplication.supplyItem_update] No public zero-argument method named '_supplyItem_update' found, performing generic datasource operation
      === 2016-10-28 09:53:11,687 [83-2] DEBUG DefaultValidators - [builtinApplication.supplyItem_update] on field: 'units' for validator type 'serverCustom', 'applyWhen' is:
      {
          operator:"and",
          criteria:[
              {
                  fieldName:"category",
                  operator:"equals",
                  value:"Adding Machine/calculator Roll"
              }
          ]
      }
      record is:
      {
          itemID:1,
          units:"Ea"
      }
      === 2016-10-28 09:53:11,746 [83-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] criterion (class com.isomorphic.criteria.criterion.SimpleCriterion): {
          operatorId:"equals",
          value:"Adding Machine/calculator Roll",
          fieldName:"category"
      }: And
      === 2016-10-28 09:53:11,746 [83-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] value (null): isEqualToConfiguredValue
      === 2016-10-28 09:53:11,746 [83-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] operand (class java.lang.String): "Adding Machine/calculator Roll": isEqualToConfiguredValue
      === 2016-10-28 09:53:11,746 [83-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] passedOp (class java.lang.String): "Adding Machine/calculator Roll": isEqualToConfiguredValue
      === 2016-10-28 09:53:11,746 [83-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] isEqualToConfiguredValue returnsfalse
      === 2016-10-28 09:53:11,746 [83-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] And 0/0: false
      === 2016-10-28 09:53:11,746 [83-2] INFO  DefaultValidators - [builtinApplication.supplyItem_update] on field: 'units' conditional validator of type 'serverCustom' is: inactive
      === 2016-10-28 09:53:11,747 [83-2] INFO  SQLDataSource - [builtinApplication.supplyItem_update] Performing update operation with
          criteria: {itemID:1}    values: {itemID:1,units:"Ea"}

    #2
    Hi claudiobosticco,

    applyWhen wasn't supported a year ago when found it in the docs as well.
    I don't know if you like the solution, but validating dependent fields is currently best done using this approach as far as I now. (Isomorphic: Please correct me if I'm wrong.)

    Best regards
    Blama

    Comment


      #3
      Hi Blama, I did notice that thread, but I was hoping that something has changed.
      Actually in the docs I don't see a warning about not using it.
      I still have to try the approach of the other thread.

      Comment


        #4
        Hi claudiobosticco,

        reading the latest blog post it seems that applyWhen is fully supported in 11.1/6.1.
        (Isomorphic: These are no longer doc'd in 6.1d)

        Best regards
        Blama

        Comment


          #5
          Originally posted by Blama View Post
          Hi claudiobosticco,

          reading the latest blog post it seems that applyWhen is fully supported in 11.1/6.1.
          Hi Blama, I also noticed it, looking forward to try it.
          Last edited by claudiobosticco; 19 Jan 2017, 07:02.

          Comment


            #6
            I just tried the visual builder from SmartClient Version: SNAPSHOT_v11.1d_2016-10-28/Enterprise Deployment (built 2016-10-28)
            It generates the applyWhen clause, but doesn't add dependentFields attribute.
            I don't know if it'll be implicit to pass server side the fields used in the applyWhen clause.
            With the 2016/10/28 build, the original test case has the same behavior.
            Last edited by claudiobosticco; 31 Oct 2016, 05:40.

            Comment


              #7
              This was a gap in the applyWhen functionality - the feature should have been merging the values to validate with the existing record, in order to provide a full set of context to the condition. We have committed a fix on the MAIN (11.1 / 6.1) branch, please try tomorrow's builds with your use case.

              Comment


                #8
                SmartClient Version: SNAPSHOT_v11.1d_2016-11-07/Enterprise Development Only (built 2016-11-07)

                Now I see that the framework is fetching the record to obtain the value and evaluate the applyWhen condition, works nicely, thank you very much.

                Comment


                  #9
                  SmartClient Version: SNAPSHOT_v11.1d_2016-12-04/Enterprise Development Only (built 2016-12-04)

                  Hello, I found a different test case where the applyWhen fails.
                  Please modify the supplyItem.ds.xml like this:
                  Code:
                  <DataSource
                      ID="supplyItem"
                      serverType="sql"
                      tableName="supplyItem"
                      titleField="itemName"
                      testFileName="/examples/shared/ds/test_data/supplyItem.data.xml"
                      dbImportFileName="/examples/shared/ds/test_data/supplyItemLarge.data.xml"
                  >
                      <fields>
                          <field name="itemID"      type="sequence" hidden="true"       primaryKey="true"/>
                          <field name="itemName"    type="text"     title="Item"        length="128"       required="true"/>
                          <field name="SKU"         type="text"     title="SKU"         length="10"        required="true"/>
                          <field name="description" type="text"     title="Description" length="2000"/>
                          <field name="category"    type="text"     title="Category"    length="128"       required="false"
                                 foreignKey="supplyCategory.categoryName"/>
                          <field name="units"       type="enum"     title="Units"       length="5">
                              <valueMap>
                                  <value>Roll</value>
                                  <value>Ea</value>
                                  <value>Pkt</value>
                                  <value>Set</value>
                                  <value>Tube</value>
                                  <value>Pad</value>
                                  <value>Ream</value>
                                  <value>Tin</value>
                                  <value>Bag</value>
                                  <value>Ctn</value>
                                  <value>Box</value>
                              </valueMap>
                              <validators>
                                  <validator type="required" stopIfFalse="true"  dependentFields="SKU">
                                      <applyWhen operator="and">
                                          <criteria>
                                              <criterion fieldName="SKU" operator="notEqual" value="foobar"/>
                                          </criteria>
                                      </applyWhen>
                                      <errorMessage>custom error message</errorMessage>
                                  </validator>
                              </validators>
                          </field>
                          <field name="unitCost"    type="float"    title="Unit Cost"   required="false">
                              <validators>
                                  <validator type="floatRange" min="0" errorMessage="Please enter a valid (positive) cost"/>
                                  <validator type="floatPrecision" precision="2" errorMessage="The maximum allowed precision is 2"/>
                              </validators>
                          </field>
                          <field name="inStock"   type="boolean"  title="In Stock"/>
                          <field name="nextShipment"  type="date" title="Next Shipment"/>
                      </fields>
                  </DataSource>
                  Then modify the #fetchOperationFS sample like this:

                  Code:
                  isc.DynamicForm.create({
                      ID:"testForm",
                      top:30,
                      width: "100%",
                      height: "100%",
                      minFieldWidth:80,
                      canEdit:true,
                      dataSource: "supplyItem",
                      fields:[{name:"SKU"},{name:"itemName"}, {name:"units", showIf:"false"}]
                  });
                  
                  isc.IButton.create({title:"save", click:"testForm.saveData()"})
                  then enter some data, and save: you'll notice that SKU equal or different from foobar gives the same behavior, the validator on the units field is ignored and the validation fails.

                  Please note that in my actual use case the validate field is hidden because is a field which is mandatory only when the dependent field is different from a specific value.

                  Server logs:
                  Code:
                   === 2016-12-05 10:08:30,527 [ec-8] INFO  RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36': Safari with Accept-Encoding header
                    === 2016-12-05 10:08:30,530 [ec-8] DEBUG XML - Parsed XML from (in memory stream): 1ms
                    === 2016-12-05 10:08:30,531 [ec-8] DEBUG RPCManager - Processing 1 requests.
                    === 2016-12-05 10:08:30,531 [ec-8] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                        values:{
                            SKU:"test",
                            itemName:"yup"
                        },
                        operationConfig:{
                            dataSource:"supplyItem",
                            repo:null,
                            operationType:"add",
                            textMatchStyle:"exact"
                        },
                        componentId:"testForm",
                        appID:"builtinApplication",
                        operation:"supplyItem_add",
                        oldValues:{
                        },
                        criteria:{
                        }
                    }
                    === 2016-12-05 10:08:30,531 [ec-8] INFO  IDACall - Performing 1 operation(s)
                    === 2016-12-05 10:08:30,533 [ec-8] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                    === 2016-12-05 10:08:30,533 [ec-8] DEBUG DeclarativeSecurity - DataSource supplyItem is not in the pre-checked list, processing...
                    === 2016-12-05 10:08:30,534 [ec-8] DEBUG AppBase - [builtinApplication.supplyItem_add] No userTypes defined, allowing anyone access to all operations for this application
                    === 2016-12-05 10:08:30,534 [ec-8] DEBUG AppBase - [builtinApplication.supplyItem_add] No public zero-argument method named '_supplyItem_add' found, performing generic datasource operation
                    === 2016-12-05 10:08:30,535 [ec-8] DEBUG ValidationContext - [builtinApplication.supplyItem_add] Adding validation errors at path '/supplyItem/units': {errorMessage=custom error message}
                    === 2016-12-05 10:08:30,535 [ec-8] INFO  Validation - [builtinApplication.supplyItem_add] Validation error: [
                        {
                            units:{
                                errorMessage:"custom error message"
                            }
                        }
                    ]
                    === 2016-12-05 10:08:30,536 [ec-8] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
                    === 2016-12-05 10:08:30,536 [ec-8] DEBUG RPCManager - non-DMI response, dropExtraFields: false
                    === 2016-12-05 10:08:30,536 [ec-8] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 561
                    === 2016-12-05 10:08:30,536 [ec-8] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 561
                    === 2016-12-05 10:08:30,536 [ec-8] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 561
                    === 2016-12-05 10:08:30,537 [ec-8] INFO  Compression - /isomorphic/IDACall: 213 -> 178 bytes
                  Code:
                   
                    === 2016-12-05 10:09:05,918 [ec-8] INFO  RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36': Safari with Accept-Encoding header
                    === 2016-12-05 10:09:05,921 [ec-8] DEBUG XML - Parsed XML from (in memory stream): 1ms
                    === 2016-12-05 10:09:05,922 [ec-8] DEBUG RPCManager - Processing 1 requests.
                    === 2016-12-05 10:09:05,922 [ec-8] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                        values:{
                            SKU:"foobar",
                            itemName:"yup"
                        },
                        operationConfig:{
                            dataSource:"supplyItem",
                            repo:null,
                            operationType:"add",
                            textMatchStyle:"exact"
                        },
                        componentId:"testForm",
                        appID:"builtinApplication",
                        operation:"supplyItem_add",
                        oldValues:{
                        },
                        criteria:{
                        }
                    }
                    === 2016-12-05 10:09:05,923 [ec-8] INFO  IDACall - Performing 1 operation(s)
                    === 2016-12-05 10:09:05,923 [ec-8] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                    === 2016-12-05 10:09:05,923 [ec-8] DEBUG DeclarativeSecurity - DataSource supplyItem is not in the pre-checked list, processing...
                    === 2016-12-05 10:09:05,923 [ec-8] DEBUG AppBase - [builtinApplication.supplyItem_add] No userTypes defined, allowing anyone access to all operations for this application
                    === 2016-12-05 10:09:05,923 [ec-8] DEBUG AppBase - [builtinApplication.supplyItem_add] No public zero-argument method named '_supplyItem_add' found, performing generic datasource operation
                    === 2016-12-05 10:09:05,923 [ec-8] DEBUG ValidationContext - [builtinApplication.supplyItem_add] Adding validation errors at path '/supplyItem/units': {errorMessage=custom error message}
                    === 2016-12-05 10:09:05,924 [ec-8] INFO  Validation - [builtinApplication.supplyItem_add] Validation error: [
                        {
                            units:{
                                errorMessage:"custom error message"
                            }
                        }
                    ]
                    === 2016-12-05 10:09:05,924 [ec-8] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
                    === 2016-12-05 10:09:05,924 [ec-8] DEBUG RPCManager - non-DMI response, dropExtraFields: false
                    === 2016-12-05 10:09:05,925 [ec-8] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 561
                    === 2016-12-05 10:09:05,925 [ec-8] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 561
                    === 2016-12-05 10:09:05,925 [ec-8] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 561
                    === 2016-12-05 10:09:05,925 [ec-8] INFO  Compression - /isomorphic/IDACall: 213 -> 178 bytes

                  Comment


                    #10
                    please see also this log from my actual use case, where I've removed the showIf from the validated field:
                    Code:
                    2016-12-05 11:23:39,896 DEBUG RPCManager Request #1 (DSRequest) payload: {
                        values:{
                            ID_POSTO_OMAGGIO_FK:45621,
                            ID_NOME_RUBRICA_FK:null,
                            ID_NAZIONE_FK:118,
                            NAZIONE:"Italia",
                            NOMINATIVO_IN_RUBRICA:false,
                            COGNOME:"FGDD",
                            NOME:"SFDGD",
                            DATA_NASCITA:new Date(1480287600000),
                            ID_COMUNE_FK:1,
                            COMUNE:"ABANO TERME",
                            LOCALITA:null
                        },
                        operationConfig:{
                            dataSource:"JTK_NOMI_TICKET",
                            repo:null,
                            operationType:"add",
                            textMatchStyle:"exact"
                        },
                        componentId:"nomiBigliettiOmaggioForm",
                        appID:"builtinApplication",
                        operation:"salvaNomeBigliettoPagamento",
                        oldValues:{
                        },
                        criteria:{
                        }
                    } 
                    2016-12-05 11:23:39,896 INFO  IDACall Performing 1 operation(s) 
                    2016-12-05 11:23:39,897 DEBUG DeclarativeSecurity Processing security checks for DataSource null, field null 
                    2016-12-05 11:23:39,897 DEBUG DeclarativeSecurity DataSource JTK_NOMI_TICKET is not in the pre-checked list, processing... 
                    2016-12-05 11:23:39,897 DEBUG BasicDataSource Validating 1 'JTK_NOMI_TICKET's at path '' 
                    2016-12-05 11:23:39,897 DEBUG BasicDataSource Validating a 'JTK_NOMI_TICKET' at path '' 
                    2016-12-05 11:23:39,897 DEBUG ISCKeyedObjectPool Borrowing object for 'capitalizeFullyTrimText' 
                    2016-12-05 11:23:39,897 DEBUG PoolableDataSourceFactory Tried to create DataSource  of type 'capitalizeFullyTrimText' but null was returned 
                    2016-12-05 11:23:39,897 DEBUG PoolableDataSourceFactory Created DataSource null of type 'capitalizeFullyTrimText' in the pooling flow 
                    2016-12-05 11:23:39,897 DEBUG BasicDataSource for field: LOCALITAadding automatically generated lengthRange validator for length:100 
                    2016-12-05 11:23:39,898 DEBUG DefaultValidators on field: 'LOCALITA' for validator type 'required', 'applyWhen' is:
                    {
                        operator:"and",
                        criteria:[
                            {
                                fieldName:"ID_NAZIONE_FK",
                                operator:"notEqual",
                                value:"118"
                            }
                        ]
                    }
                    record is:
                    {
                        ID_POSTO_OMAGGIO_FK:45621,
                        ID_NOME_RUBRICA_FK:null,
                        ID_NAZIONE_FK:118,
                        NAZIONE:"Italia",
                        NOMINATIVO_IN_RUBRICA:false,
                        COGNOME:"FGDD",
                        NOME:"SFDGD",
                        DATA_NASCITA:new Date(1480287600000),
                        ID_COMUNE_FK:1,
                        COMUNE:"ABANO TERME",
                        LOCALITA:null,
                        CREATOR:"claudio.bosticco@juventus.com",
                        CREATOR_TIMESTAMP:new Date(1480933419897),
                        MODIFIER:"claudio.bosticco@juventus.com",
                        MODIFIER_TIMESTAMP:new Date(1480933419897)
                    } 
                    2016-12-05 11:23:39,898 DEBUG DefaultOperators criterion (class com.isomorphic.criteria.criterion.SimpleCriterion): {
                        operatorId:"notEqual",
                        value:"118",
                        fieldName:"ID_NAZIONE_FK"
                    }: And 
                    2016-12-05 11:23:39,899 DEBUG DefaultOperators value (class java.lang.Long): 118: isEqualToConfiguredValue 
                    2016-12-05 11:23:39,899 DEBUG DefaultOperators operand (class java.lang.String): "118": isEqualToConfiguredValue 
                    2016-12-05 11:23:39,899 DEBUG DefaultOperators passedOp (class java.lang.Long): 118: isEqualToConfiguredValue 
                    2016-12-05 11:23:39,899 DEBUG DefaultOperators isEqualToConfiguredValue returnstrue 
                    2016-12-05 11:23:39,899 DEBUG DefaultOperators And 0/0: false 
                    2016-12-05 11:23:39,899 INFO  DefaultValidators on field: 'LOCALITA' conditional validator of type 'required' is: inactive 
                    2016-12-05 11:23:39,899 DEBUG DefaultValidators on field: 'ID_COMUNE_FK' for validator type 'required', 'applyWhen' is:
                    {
                        operator:"and",
                        criteria:[
                            {
                                fieldName:"ID_NAZIONE_FK",
                                operator:"equals",
                                value:"118"
                            }
                        ]
                    }
                    record is:
                    {
                        ID_POSTO_OMAGGIO_FK:45621,
                        ID_NOME_RUBRICA_FK:null,
                        ID_NAZIONE_FK:118,
                        NAZIONE:"Italia",
                        NOMINATIVO_IN_RUBRICA:false,
                        COGNOME:"FGDD",
                        NOME:"SFDGD",
                        DATA_NASCITA:new Date(1480287600000),
                        ID_COMUNE_FK:1,
                        COMUNE:"ABANO TERME",
                        LOCALITA:null,
                        CREATOR:"claudio.bosticco@juventus.com",
                        CREATOR_TIMESTAMP:new Date(1480933419897),
                        MODIFIER:"claudio.bosticco@juventus.com",
                        MODIFIER_TIMESTAMP:new Date(1480933419897)
                    } 
                    2016-12-05 11:23:39,900 DEBUG DefaultOperators criterion (class com.isomorphic.criteria.criterion.SimpleCriterion): {
                        operatorId:"equals",
                        value:"118",
                        fieldName:"ID_NAZIONE_FK"
                    }: And 
                    2016-12-05 11:23:39,900 DEBUG DefaultOperators value (class java.lang.Long): 118: isEqualToConfiguredValue 
                    2016-12-05 11:23:39,900 DEBUG DefaultOperators operand (class java.lang.String): "118": isEqualToConfiguredValue 
                    2016-12-05 11:23:39,900 DEBUG DefaultOperators passedOp (class java.lang.Long): 118: isEqualToConfiguredValue 
                    2016-12-05 11:23:39,900 DEBUG DefaultOperators isEqualToConfiguredValue returnstrue 
                    2016-12-05 11:23:39,900 DEBUG DefaultOperators And 0/0: true 
                    2016-12-05 11:23:39,900 INFO  DefaultValidators on field: 'ID_COMUNE_FK' conditional validator of type 'required' is: active 
                    2016-12-05 11:23:39,900 DEBUG BasicDataSource for field: NOMEadding automatically generated lengthRange validator for length:100 
                    2016-12-05 11:23:39,901 DEBUG BasicDataSource for field: COGNOMEadding automatically generated lengthRange validator for length:100 
                    2016-12-05 11:23:39,901 DEBUG BasicDataSource for field: NAZIONEadding automatically generated lengthRange validator for length:200 
                    2016-12-05 11:23:39,902 DEBUG BasicDataSource for field: COMUNEadding automatically generated lengthRange validator for length:40 
                    2016-12-05 11:23:39,902 DEBUG ValidationContext Adding validation errors at path '/JTK_NOMI_TICKET/LOCALITA': {errorMessage=Field is required} 
                    2016-12-05 11:23:39,902 DEBUG BasicDataSource Done validating 1 'JTK_NOMI_TICKET's at path '': 5ms (avg 5) 
                    2016-12-05 11:23:39,902 DEBUG DataSource post-validation valueSet: [
                        {
                            ID_POSTO_OMAGGIO_FK:45621,
                            ID_NOME_RUBRICA_FK:null,
                            ID_NAZIONE_FK:118,
                            NAZIONE:"Italia",
                            NOMINATIVO_IN_RUBRICA:false,
                            COGNOME:"Fgdd",
                            NOME:"Sfdgd",
                            DATA_NASCITA:new Date(1480287600000),
                            ID_COMUNE_FK:1,
                            COMUNE:"ABANO TERME",
                            LOCALITA:null,
                            CREATOR:"claudio.bosticco@juventus.com",
                            CREATOR_TIMESTAMP:new Date(1480933419897),
                            MODIFIER:"claudio.bosticco@juventus.com",
                            MODIFIER_TIMESTAMP:new Date(1480933419897)
                        }
                    ] 
                    2016-12-05 11:23:39,902 INFO  Validation Validation error: [
                        {
                            LOCALITA:{
                                errorMessage:"Field is required"
                            }
                        }
                    ] 
                    2016-12-05 11:23:39,902 DEBUG DSRequest About to free up resources for request of type add on DataSource JTK_NOMI_TICKET 
                    2016-12-05 11:23:39,902 DEBUG DSRequest Ignoring freeResources call because this is not a primary request! 
                    2016-12-05 11:23:39,902 DEBUG RPCManager Content type for RPC transaction: text/plain; charset=UTF-8 
                    2016-12-05 11:23:39,902 DEBUG RPCManager non-DMI response, dropExtraFields: false 
                    2016-12-05 11:23:39,902 DEBUG DSRequest Ignoring freeQueueResources call because this is not a primary request! 
                    2016-12-05 11:23:39,903 INFO  Compression /Jtk/isomorphic/IDACall: 213 -> 185 bytes 
                    2016-12-05 11:23:40,169 INFO  RequestContext URL: '/Jtk/isomorphic/system/reference/skin/images/server_client_exchange.png', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36': Safari with Accept-Encoding header
                    you may see this line:
                    Code:
                    2016-12-05 11:23:39,899 INFO  DefaultValidators on field: 'LOCALITA' conditional validator of type 'required' is: inactive
                    but later it raises a validation error on the same field.

                    Comment


                      #11
                      We have implemented a change to correct this; it will be in tomorrow's builds of 11.1d. You will have to change your field definition to use the new flag "conditionallyRequired" - this tells the server that it should look for a "required" validator with an applyWhen clause (we don't do that by default because of a concern about the performance implications of looking through the full list of validators for every field when trying to decide if we have missing values in a record)

                      Comment


                        #12
                        Actually, forget that comment about setting the "conditionallyRequired" flag - that is something that should be automatically maintained by the framework (and now is), so tomorrow's build should fix your issue without you having to change anything.

                        Comment


                          #13
                          SmartClient Version: SNAPSHOT_v11.1d_2016-12-11/Enterprise Development Only (built 2016-12-11)

                          Actually it seems that there's still some problem.

                          This is the server log for the test case from post #9, for two operations.
                          First, an add operation with SKU=foobar, so 'units' is NOT required: a record is inserted.
                          Then, an update operation with SKU!=foobar, so 'units' IS required: there isn't a validation error, so the record is updated.

                          Code:
                            
                             
                            === 2016-12-13 09:49:15,490 [ec-4] INFO  RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36': Safari with Accept-Encoding header
                            === 2016-12-13 09:49:15,491 [ec-4] DEBUG XML - Parsed XML from (in memory stream): 1ms
                            === 2016-12-13 09:49:15,492 [ec-4] DEBUG RPCManager - Processing 1 requests.
                            === 2016-12-13 09:49:15,492 [ec-4] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                                values:{
                                    SKU:"foobar",
                                    itemName:"yup"
                                },
                                operationConfig:{
                                    dataSource:"supplyItem",
                                    repo:null,
                                    operationType:"add",
                                    textMatchStyle:"exact"
                                },
                                componentId:"testForm",
                                appID:"builtinApplication",
                                operation:"supplyItem_add",
                                oldValues:{
                                },
                                criteria:{
                                }
                            }
                            === 2016-12-13 09:49:15,492 [ec-4] INFO  IDACall - Performing 1 operation(s)
                            === 2016-12-13 09:49:15,492 [ec-4] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                            === 2016-12-13 09:49:15,492 [ec-4] DEBUG DeclarativeSecurity - DataSource supplyItem is not in the pre-checked list, processing...
                            === 2016-12-13 09:49:15,493 [ec-4] DEBUG AppBase - [builtinApplication.supplyItem_add] No userTypes defined, allowing anyone access to all operations for this application
                            === 2016-12-13 09:49:15,493 [ec-4] DEBUG AppBase - [builtinApplication.supplyItem_add] No public zero-argument method named '_supplyItem_add' found, performing generic datasource operation
                            === 2016-12-13 09:49:15,493 [ec-4] DEBUG DefaultOperators - [builtinApplication.supplyItem_add] criterion (class com.isomorphic.criteria.criterion.SimpleCriterion): {
                                operatorId:"notEqual",
                                value:"foobar",
                                fieldName:"SKU"
                            }: And
                            === 2016-12-13 09:49:15,493 [ec-4] DEBUG DefaultOperators - [builtinApplication.supplyItem_add] value (class java.lang.String): "foobar": isEqualToConfiguredValue
                            === 2016-12-13 09:49:15,493 [ec-4] DEBUG DefaultOperators - [builtinApplication.supplyItem_add] operand (class java.lang.String): "foobar": isEqualToConfiguredValue
                            === 2016-12-13 09:49:15,493 [ec-4] DEBUG DefaultOperators - [builtinApplication.supplyItem_add] passedOp (class java.lang.String): "foobar": isEqualToConfiguredValue
                            === 2016-12-13 09:49:15,493 [ec-4] DEBUG DefaultOperators - [builtinApplication.supplyItem_add] isEqualToConfiguredValue returnstrue
                            === 2016-12-13 09:49:15,493 [ec-4] DEBUG DefaultOperators - [builtinApplication.supplyItem_add] And 0/0: false
                            === 2016-12-13 09:49:15,493 [ec-4] INFO  SQLDataSource - [builtinApplication.supplyItem_add] Performing add operation with
                                criteria: {SKU:"foobar",itemName:"yup"}    values: {SKU:"foobar",itemName:"yup"}
                            === 2016-12-13 09:49:15,494 [ec-4] DEBUG SQLValuesClause - [builtinApplication.supplyItem_add] Sequences: {itemID=__default}
                            === 2016-12-13 09:49:15,494 [ec-4] DEBUG SQLConnectionManager - [builtinApplication.supplyItem_add] Borrowed connection '1773132818'
                            === 2016-12-13 09:49:15,494 [ec-4] DEBUG SQLTransaction - [builtinApplication.supplyItem_add] Started new HSQLDB transaction "1773132818"
                            === 2016-12-13 09:49:15,494 [ec-4] DEBUG SQLDataSource - [builtinApplication.supplyItem_add] Setting DSRequest as being part of a transaction
                            === 2016-12-13 09:49:15,495 [ec-4] INFO  SQLDriver - [builtinApplication.supplyItem_add] Executing SQL query on 'HSQLDB' using connection '1773132818': INSERT INTO supplyItem (SKU, itemName, itemID) VALUES ('foobar', 'yup', null)
                            === 2016-12-13 09:49:15,495 [ec-4] DEBUG SQLDriver - [builtinApplication.supplyItem_add] SequenceMode is not JDBC_DRIVER, skipping search for generated values
                            === 2016-12-13 09:49:15,495 [ec-4] DEBUG SQLDataSource - [builtinApplication.supplyItem_add] add operation affected 1 rows
                            === 2016-12-13 09:49:15,495 [ec-4] DEBUG HSQLDBDriver - [builtinApplication.supplyItem_add] fetchLastRow data - primaryKeysPresent: {}sequencesNotPresent: [itemID]
                            === 2016-12-13 09:49:15,495 [ec-4] DEBUG SQLDataSource - [builtinApplication.supplyItem_add] Setting DSRequest as being part of a transaction
                            === 2016-12-13 09:49:15,495 [ec-4] INFO  SQLDriver - [builtinApplication.supplyItem_add] Executing SQL query on 'HSQLDB' using connection '1773132818': CALL IDENTITY()
                            === 2016-12-13 09:49:15,496 [ec-4] INFO  SQLDataSource - [builtinApplication.supplyItem_add] primaryKeys: {itemID=3963}
                            === 2016-12-13 09:49:15,496 [ec-4] DEBUG DeclarativeSecurity - [builtinApplication.supplyItem_add] Processing security checks for DataSource null, field null
                            === 2016-12-13 09:49:15,496 [ec-4] DEBUG DeclarativeSecurity - [builtinApplication.supplyItem_add] DataSource supplyItem is not in the pre-checked list, processing...
                            === 2016-12-13 09:49:15,496 [ec-4] DEBUG AppBase - [builtinApplication.supplyItem_add, builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application
                            === 2016-12-13 09:49:15,496 [ec-4] DEBUG AppBase - [builtinApplication.supplyItem_add, builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation
                            === 2016-12-13 09:49:15,496 [ec-4] INFO  SQLDataSource - [builtinApplication.supplyItem_add, builtinApplication.null] Performing fetch operation with
                                criteria: {itemID:3963}    values: {itemID:3963}
                            === 2016-12-13 09:49:15,497 [ec-4] INFO  SQLDataSource - [builtinApplication.supplyItem_add, builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
                            === 2016-12-13 09:49:15,497 [ec-4] DEBUG SQLDataSource - [builtinApplication.supplyItem_add, builtinApplication.null] Using SQL Limit query
                            === 2016-12-13 09:49:15,497 [ec-4] DEBUG SQLDataSource - [builtinApplication.supplyItem_add, builtinApplication.null] SQL windowed select rows 0->-1, result size 1. Query: SELECT LIMIT 0 1  supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment FROM supplyItem WHERE (supplyItem.itemID=3963)
                            === 2016-12-13 09:49:15,497 [ec-4] DEBUG SQLDataSource - [builtinApplication.supplyItem_add, builtinApplication.null] SQL windowed select rows 0->-1, result size 1. Query: SELECT LIMIT 0 1  supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment FROM supplyItem WHERE (supplyItem.itemID=3963)
                            === 2016-12-13 09:49:15,497 [ec-4] DEBUG SQLDataSource - [builtinApplication.supplyItem_add, builtinApplication.null] Setting DSRequest as being part of a transaction
                            === 2016-12-13 09:49:15,497 [ec-4] INFO  SQLDataSource - [builtinApplication.supplyItem_add, builtinApplication.null] 791: Executing cache sync query on 'HSQLDB': SELECT LIMIT 0 1  supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment FROM supplyItem WHERE (supplyItem.itemID=3963)
                            === 2016-12-13 09:49:15,498 [ec-4] INFO  DSResponse - [builtinApplication.supplyItem_add] DSResponse: List with 1 items
                            === 2016-12-13 09:49:15,498 [ec-4] INFO  DSResponse - DSResponse: List with 1 items
                            === 2016-12-13 09:49:15,498 [ec-4] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
                            === 2016-12-13 09:49:15,498 [ec-4] DEBUG SQLTransaction - Committing HSQLDB transaction "1773132818"
                            === 2016-12-13 09:49:15,498 [ec-4] DEBUG SQLTransaction - Committing HSQLDB transaction "1773132818"
                            === 2016-12-13 09:49:15,498 [ec-4] DEBUG RPCManager - non-DMI response, dropExtraFields: false
                            === 2016-12-13 09:49:15,499 [ec-4] DEBUG SQLTransaction - getConnection() looked for transactional connection for HSQLDB:  hashcode "1773132818"
                            === 2016-12-13 09:49:15,499 [ec-4] DEBUG SQLTransaction - Ending HSQLDB transaction "1773132818"
                            === 2016-12-13 09:49:15,499 [ec-4] DEBUG SQLConnectionManager - About to close connection with hashcode "1773132818"
                            === 2016-12-13 09:49:15,499 [ec-4] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 791
                            === 2016-12-13 09:49:15,499 [ec-4] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 791
                            === 2016-12-13 09:49:15,499 [ec-4] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 791
                            === 2016-12-13 09:49:15,499 [ec-4] INFO  Compression - /isomorphic/IDACall: 220 -> 190 bytes
                            === 2016-12-13 09:49:36,330 [ec-2] INFO  RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36': Safari with Accept-Encoding header
                            === 2016-12-13 09:49:36,332 [ec-2] DEBUG XML - Parsed XML from (in memory stream): 1ms
                            === 2016-12-13 09:49:36,333 [ec-2] DEBUG RPCManager - Processing 1 requests.
                            === 2016-12-13 09:49:36,333 [ec-2] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                                criteria:{
                                    itemID:3963
                                },
                                values:{
                                    SKU:"fail",
                                    itemName:"yup",
                                    category:"",
                                    itemID:3963,
                                    unitCost:0
                                },
                                operationConfig:{
                                    dataSource:"supplyItem",
                                    repo:null,
                                    operationType:"update",
                                    textMatchStyle:"exact"
                                },
                                componentId:"testForm",
                                appID:"builtinApplication",
                                operation:"supplyItem_update",
                                oldValues:{
                                    SKU:"foobar",
                                    itemName:"yup",
                                    category:"",
                                    itemID:3963,
                                    unitCost:0
                                }
                            }
                            === 2016-12-13 09:49:36,333 [ec-2] INFO  IDACall - Performing 1 operation(s)
                            === 2016-12-13 09:49:36,333 [ec-2] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                            === 2016-12-13 09:49:36,333 [ec-2] DEBUG DeclarativeSecurity - DataSource supplyItem is not in the pre-checked list, processing...
                            === 2016-12-13 09:49:36,333 [ec-2] DEBUG AppBase - [builtinApplication.supplyItem_update] No userTypes defined, allowing anyone access to all operations for this application
                            === 2016-12-13 09:49:36,333 [ec-2] DEBUG AppBase - [builtinApplication.supplyItem_update] No public zero-argument method named '_supplyItem_update' found, performing generic datasource operation
                            === 2016-12-13 09:49:36,334 [ec-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] criterion (class com.isomorphic.criteria.criterion.SimpleCriterion): {
                                operatorId:"notEqual",
                                value:"foobar",
                                fieldName:"SKU"
                            }: And
                            === 2016-12-13 09:49:36,334 [ec-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] value (class java.lang.String): "fail": isEqualToConfiguredValue
                            === 2016-12-13 09:49:36,334 [ec-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] operand (class java.lang.String): "foobar": isEqualToConfiguredValue
                            === 2016-12-13 09:49:36,334 [ec-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] passedOp (class java.lang.String): "foobar": isEqualToConfiguredValue
                            === 2016-12-13 09:49:36,334 [ec-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] isEqualToConfiguredValue returnsfalse
                            === 2016-12-13 09:49:36,334 [ec-2] DEBUG DefaultOperators - [builtinApplication.supplyItem_update] And 0/0: true
                            === 2016-12-13 09:49:36,334 [ec-2] INFO  SQLDataSource - [builtinApplication.supplyItem_update] Performing update operation with
                                criteria: {itemID:3963}    values: {SKU:"fail",itemName:"yup",category:"",itemID:3963,unitCost:0.0}
                            === 2016-12-13 09:49:36,335 [ec-2] DEBUG SQLConnectionManager - [builtinApplication.supplyItem_update] Borrowed connection '1773132818'
                            === 2016-12-13 09:49:36,335 [ec-2] DEBUG SQLTransaction - [builtinApplication.supplyItem_update] Started new HSQLDB transaction "1773132818"
                            === 2016-12-13 09:49:36,335 [ec-2] DEBUG SQLDataSource - [builtinApplication.supplyItem_update] Setting DSRequest as being part of a transaction
                            === 2016-12-13 09:49:36,335 [ec-2] INFO  SQLDriver - [builtinApplication.supplyItem_update] Executing SQL query on 'HSQLDB' using connection '1773132818': UPDATE supplyItem SET SKU='fail', category='', itemName='yup', unitCost=0.0 WHERE (supplyItem.itemID=3963)
                            === 2016-12-13 09:49:36,336 [ec-2] DEBUG SQLDataSource - [builtinApplication.supplyItem_update] update operation affected 1 rows
                            === 2016-12-13 09:49:36,336 [ec-2] INFO  SQLDataSource - [builtinApplication.supplyItem_update] primaryKeys: {itemID=3963}
                            === 2016-12-13 09:49:36,336 [ec-2] DEBUG DeclarativeSecurity - [builtinApplication.supplyItem_update] Processing security checks for DataSource null, field null
                            === 2016-12-13 09:49:36,336 [ec-2] DEBUG DeclarativeSecurity - [builtinApplication.supplyItem_update] DataSource supplyItem is not in the pre-checked list, processing...
                            === 2016-12-13 09:49:36,336 [ec-2] DEBUG AppBase - [builtinApplication.supplyItem_update, builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application
                            === 2016-12-13 09:49:36,336 [ec-2] DEBUG AppBase - [builtinApplication.supplyItem_update, builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation
                            === 2016-12-13 09:49:36,337 [ec-2] INFO  SQLDataSource - [builtinApplication.supplyItem_update, builtinApplication.null] Performing fetch operation with
                                criteria: {itemID:3963}    values: {itemID:3963}
                            === 2016-12-13 09:49:36,337 [ec-2] INFO  SQLDataSource - [builtinApplication.supplyItem_update, builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
                            === 2016-12-13 09:49:36,337 [ec-2] DEBUG SQLDataSource - [builtinApplication.supplyItem_update, builtinApplication.null] Using SQL Limit query
                            === 2016-12-13 09:49:36,337 [ec-2] DEBUG SQLDataSource - [builtinApplication.supplyItem_update, builtinApplication.null] SQL windowed select rows 0->-1, result size 1. Query: SELECT LIMIT 0 1  supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment FROM supplyItem WHERE (supplyItem.itemID=3963)
                            === 2016-12-13 09:49:36,337 [ec-2] DEBUG SQLDataSource - [builtinApplication.supplyItem_update, builtinApplication.null] SQL windowed select rows 0->-1, result size 1. Query: SELECT LIMIT 0 1  supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment FROM supplyItem WHERE (supplyItem.itemID=3963)
                            === 2016-12-13 09:49:36,337 [ec-2] DEBUG SQLDataSource - [builtinApplication.supplyItem_update, builtinApplication.null] Setting DSRequest as being part of a transaction
                            === 2016-12-13 09:49:36,337 [ec-2] INFO  SQLDataSource - [builtinApplication.supplyItem_update, builtinApplication.null] 791: Executing cache sync query on 'HSQLDB': SELECT LIMIT 0 1  supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment FROM supplyItem WHERE (supplyItem.itemID=3963)
                            === 2016-12-13 09:49:36,338 [ec-2] INFO  DSResponse - [builtinApplication.supplyItem_update] DSResponse: List with 1 items
                            === 2016-12-13 09:49:36,339 [ec-2] INFO  DSResponse - DSResponse: List with 1 items
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG SQLTransaction - Committing HSQLDB transaction "1773132818"
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG SQLTransaction - Committing HSQLDB transaction "1773132818"
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG RPCManager - non-DMI response, dropExtraFields: false
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG SQLTransaction - getConnection() looked for transactional connection for HSQLDB:  hashcode "1773132818"
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG SQLTransaction - Ending HSQLDB transaction "1773132818"
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG SQLConnectionManager - About to close connection with hashcode "1773132818"
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 791
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 791
                            === 2016-12-13 09:49:36,339 [ec-2] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 791
                            === 2016-12-13 09:49:36,339 [ec-2] INFO  Compression - /isomorphic/IDACall: 221 -> 189 bytes
                          nothing is logged in the javascript section of the developer console.

                          Comment


                            #14
                            I've just found another problem.
                            Please modify the supplyItem.ds.xml like this:
                            Code:
                            <DataSource
                                ID="supplyItem"
                                serverType="sql"
                                tableName="supplyItem"
                                titleField="itemName"
                                testFileName="/examples/shared/ds/test_data/supplyItem.data.xml"
                                dbImportFileName="/examples/shared/ds/test_data/supplyItemLarge.data.xml"
                            >
                                <fields>
                                    <field name="itemID"      type="sequence" hidden="true"       primaryKey="true"/>
                                    <field name="itemName"    type="text"     title="Item"        length="128"       required="false"/>
                                    <field name="SKU"         type="text"     title="SKU"         length="10"        required="false"/>
                                    <field name="description" type="text"     title="Description" length="2000"/>
                                    <field name="category"    type="text"     title="Category"    length="128"       required="false"
                                           foreignKey="supplyCategory.categoryName"/>
                                    <field name="units"       type="enum"     title="Units"       length="5">
                                        <valueMap>
                                            <value>Roll</value>
                                            <value>Ea</value>
                                            <value>Pkt</value>
                                            <value>Set</value>
                                            <value>Tube</value>
                                            <value>Pad</value>
                                            <value>Ream</value>
                                            <value>Tin</value>
                                            <value>Bag</value>
                                            <value>Ctn</value>
                                            <value>Box</value>
                                        </valueMap>
                                        <validators>
                                            <validator type="required" stopIfFalse="true"  dependentFields="SKU">
                                                <applyWhen operator="and">
                                                    <criteria>
                                                        <criterion fieldName="SKU" operator="notNull"/>
                                                    </criteria>
                                                </applyWhen>
                                                <errorMessage>custom error message</errorMessage>
                                            </validator>
                                        </validators>
                                    </field>
                                    <field name="unitCost"    type="float"    title="Unit Cost"   required="false">
                                        <validators>
                                            <validator type="floatRange" min="0" errorMessage="Please enter a valid (positive) cost"/>
                                            <validator type="floatPrecision" precision="2" errorMessage="The maximum allowed precision is 2"/>
                                        </validators>
                                    </field>
                                    <field name="inStock"   type="boolean"  title="In Stock"/>
                                    <field name="nextShipment"  type="date" title="Next Shipment"/>
                                </fields>
                            </DataSource>
                            Then modify the #fetchOperationFS sample like this:
                            Code:
                            isc.ListGrid.create({
                                ID:"dsListGrid", 
                                width: "100%",
                                height: "100%",
                                minFieldWidth:80,
                                canEdit:true,
                                dataSource: "supplyItem",
                                fields:[
                                  {name:"category"}, {name:"description"}, {name:"units"}, {name:"SKU"}
                                ] 
                            }).startEditingNew();
                            then try to add a row without 'units' and 'SKU' values, you'll see a validation error on 'units', but it doesn't have to be required because SKU is null.

                            Comment


                              #15
                              Hello Isomorphic, were you able to replicate the problem from post #14? Please let me know if you need more details.

                              Comment

                              Working...
                              X