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

    Strange ifFunction FormItem warning in logs

    Hello, please consider this code:
    FormItem iType = FormUtils.createFormItem(fields, ds, CSConstants.FIELD_IMAGESERVICETYPE);
    AdvancedCriteria crit = new AdvancedCriteria(CSConstants.FIELD_IMAGESERVICETYPE, OperatorId.EQUALS, 0);
    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.

    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.



      Apologies. It's 13.0-d20211002.

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

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


        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?


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


            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.


              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).


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