MyFaces Core
  1. MyFaces Core
  2. MYFACES-1899

Why RequiredMessage is not supported in SelectMany components?

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.4
    • Component/s: JSR-252
    • Labels:
      None

      Description

      All the select many components doesn't support attribute "requiredMessage". Example SelectManyCheckbox.

      <h:selectManyCheckbox value="#

      {ElExpression}

      " required="true" requiredMessage="Value is required">

      For the above component it always shows the myfaces default error message. I had a look into UISelectMany.java seems requiredMessage is not been taken care.

      Please fix the issue, if you have any specific reason for not supporting requiredMessage, do let me know.

      Thanks,
      Venkat

        Activity

        Leonardo Uribe made changes -
        Fix Version/s 1.2.4 [ 12313378 ]
        Fix Version/s 1.2.4-SNAPSHOT [ 12313145 ]
        Leonardo Uribe made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Leonardo Uribe [ lu4242 ]
        Fix Version/s 1.2.4-SNAPSHOT [ 12313145 ]
        Hide
        Leonardo Uribe added a comment -

        Checking the code it is clear the missing check for requiredMessage!=null on method validateValue of UISelectMany

        The solution is do the same as UIInput:

        if (isRequired() && !hasValues)
        {
        if(getRequiredMessage() != null)

        { String requiredMessage = getRequiredMessage(); context.addMessage(this.getClientId(context),new FacesMessage(FacesMessage.SEVERITY_ERROR,requiredMessage,requiredMessage)); }

        else
        {
        _MessageUtils.addErrorMessage(context, this, REQUIRED_MESSAGE_ID, new Object[]{_MessageUtils.getLabel(context,this)});
        }
        setValid(false);
        return;
        }

        Show
        Leonardo Uribe added a comment - Checking the code it is clear the missing check for requiredMessage!=null on method validateValue of UISelectMany The solution is do the same as UIInput: if (isRequired() && !hasValues) { if(getRequiredMessage() != null) { String requiredMessage = getRequiredMessage(); context.addMessage(this.getClientId(context),new FacesMessage(FacesMessage.SEVERITY_ERROR,requiredMessage,requiredMessage)); } else { _MessageUtils.addErrorMessage(context, this, REQUIRED_MESSAGE_ID, new Object[]{_MessageUtils.getLabel(context,this)}); } setValid(false); return; }
        Venkat Sadasivam created issue -

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Venkat Sadasivam
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development