Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-9883

Boolean property value is evaluated as string instead of a boolean

    Details

    • Type: Bug Fix Bug Fix
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.3.0-rc1, 2.3
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Similar issues:
      KULRICE-13707Implement better boolean datatype support for searchable attributes
      KULRICE-5379align the ParameterService & ConfigService understanding of boolean string values
      KULRICE-4481Kim maintenance fails sort of when dealing with boolean type qualifiers
      KULRICE-5376Uif Framework - Refactor conditional expressions for non String fields
      KULRICE-12912FilterGenerator throws exception when attribute is boolean
      KULRICE-12734Update default values to use a boolean variable rather than a list
      KULRICE-6808Kim Role Maintenance - Custom boolean role qualifier values are not being converted properly
      KULRICE-8425Problems with UifBeanFactoryPostProcessor expression handling for nested properties and lists prevent bean property overrides (such as fieldInquiry.render) from working
      KULRICE-3231Stop BO dictionary service from returning null for boolean calls
      KULRICE-3599DocumentTypeXmlParser bug - parsing policy string values erroneously sets all policy values to TRUE
    • Rice Module:
      KRAD
    • KRAD Feature Area:
      UIF Script
    • Application Requirement:
      KS My Plan
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required
    • Include in Release Notes?:
      Yes

      Description

      A property which is a boolean has a value that becomes a string within javascript.

      Example:

      A button with a disabled spring expression evaluates properly on load, planExists is false so @

      {#form.planExists EQ false} returns true and the button is disabled. But in the script that sets up the disabled check, the function coerceValue("planExists") returns false as a string so the condition function created will return false since the string "false" does not equal boolean false.

      Tried changing the spring expression to @{#form.planExists EQ 'false'} so that the javascript would be matching strings, but the expression fails for the initial value.

      See XML and generated script below:

      XML:

      <bean id="plan_audit_validate" parent="Uif-PrimaryActionButton" p:actionLabel="Audit Your Plan"
      p:title="Audit Your Plan">
      <property name="disabled" value="@{#form.planExists EQ false}

      "/>
      <property name="actionScript" value="
      validatePlanAudit('plan_hand_off_container','plan_audit_hand_off','reviewPlanAudit','audit',

      {viewId:'PlanAuditHandOff-FormView',pageId:'plan_audit_hand_off'}

      );
      "/>
      </bean>

      Generated Javascript:

      var condition = function()

      {return (coerceValue("planExists") == false);}

      ;
      setupDisabledCheck('planExists', 'plan_audit_validate', 'action', condition, false);

      Possible fix:

      I created a workaround by redefined the coerceValue function and added the following before the return to convert true and false strings to booleans:

      if (value == "true")

      { value = true }

      if (value == "false")

      { value = false }

        Activity

        Hide
        Jerry Neal (Inactive) added a comment -

        Jessica,

        Since Garett has a fix here this would be very quick to put in for RC1.

        Jerry

        Show
        Jerry Neal (Inactive) added a comment - Jessica, Since Garett has a fix here this would be very quick to put in for RC1. Jerry
        Hide
        Brian Smith (Inactive) added a comment - - edited

        coerceValue will now match the strings true or false and return boolean values instead of string values, case-insensitive

        Show
        Brian Smith (Inactive) added a comment - - edited coerceValue will now match the strings true or false and return boolean values instead of string values, case-insensitive

          People

          • Assignee:
            Brian Smith (Inactive)
            Reporter:
            Garett Gowens
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Structure Helper Panel