3 Replies Latest reply on Jul 24, 2009 3:43 PM by Alex Cougarman

    Adding setRequired() programmatically to expression

    Alex Cougarman Apprentice

      How do you set the required attribute of a dynamically created component to an expression? Here's what I'm trying to do:

      StringBuilder el = new StringBuilder();
      HtmlInputText hoursInput = new HtmlInputText();
      
      el.append("#{");
      el.append("calOvertimeDate_" + Integer.toString(componentCount));
      el.append(".value == null || ");
      el.append("calOvertimeDate_" + Integer.toString(componentCount));
      el.append(".value == '' ? false : true}");
      
      hoursInput.setRequired(el.toString());


      It doesn't like the last line of code because it's expecting a boolean and I'm giving it an expression to be evaluated at runtime. I'd like to use a setRequiredExpression, but no such thing exists as far as I can tell. Help!!