Announcement

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

    Strange ifFunction FormItem warning in logs

    Hello, please consider this code:
    Code:
    FormItem iType = FormUtils.createFormItem(fields, ds, CSConstants.FIELD_IMAGESERVICETYPE);
    AdvancedCriteria crit = new AdvancedCriteria(CSConstants.FIELD_IMAGESERVICETYPE, OperatorId.EQUALS, 0);
     iType.setReadOnlyWhen(crit);
    if i call the ReadOnlyWhen, i get the following in the logs:
    WARN:validation:isOneOf validator specified with no specified list of options or valueMap - validator will always fail. Field definition:null
    I am not sure what this means, am i doing something wrong? If it's not obvious from the code, my goal is for the FormItem to be readonly if its value is 0.

    #2
    Thanks for the report. Can you provide some additional details:

    1. What version of SmartGWT are you using?
    2. What are the details of the DataSource field and the corresponding FormItem? In particular type and valueMap but as much info as you can provide will help.

    Regards,
    Isomorphic

    Comment


      #3
      Apologies. It's 13.0-d20211002.

      The FormItem is a SelectItem, and the ds field is defined like this:

      Code:
      <field name="itype" type="enum" required="false" defaultValue="0">
                  <title>
                      <fmt:message key="imageService"/>
                  </title>
                  <valueMap>
                      <value ID="0">
                          <fmt:message key="iType.0"/>
                      </value>
                      <value ID="1">
                          <fmt:message key="iType.1"/>
                      </value>
                      <value ID="2">
                          <fmt:message key="iType.2"/>
                      </value>
                  </valueMap>
              </field>

      Comment


        #4
        Thanks for the details. We were able to reproduce the issue and the messages will not be logged in builds starting with 2021-12-09.

        For confirmation, we did not find the rule failing - only that an unwanted warning was logged. Is that correct?

        Comment


          #5
          Yes indeed, it made me not sure that it would always work though. Great that you found it right away.

          Comment


            #6
            I just remembered - I have one little related comment here. I find it a bit confusing that you have a 'setShowIfCondition' method that takes a FormItemIfFunction, but for this usecase, 'setReadOnlyWhen', i instead have to create an AdvancedCriteria.

            I would have preferred both methods to take a FormItemIfFunction for consistency, also it would have made it possible to reuse classes. But perhaps there is some technical reason you went this route.

            Comment


              #7
              AdvancedCriteria can be edited and re-edited in visual tools like Reify, so this makes the functionality accessible to non-programmers using Reify (and related tools).

              Comment


                #8
                To be consistent with AdvancedCriteria, you may be able to use setVisibleWhen instead of setShowIfCondition in your use case.

                Comment

                Working...
                X