3 Replies Latest reply on Sep 9, 2013 1:52 PM by wrdlprmpft

    Conditional filling field value in EL

    wrdlprmpft

      I had described a work around to RF-12152  (see here).

       

      It is basically setting an empty string on focus to a field to activate the autocomplete function:

       

      onfocus="#{rich:component('region')}.setValue(' ');"

       

      Now there is another issue with it. It should obviously only overwrite the field contents with an empty string, if there is no value already in it, otherwise the value should stay as it is.

       

      I tried

       

      onfocus="#{empty rich:component('institutionName')} ? #{rich:component('institutionName')}.setValue(' ');"

       

      but this seems not working.

       

      Does anyone have a solution for that?

       

      Thanks in advance

       

      Chris

        • 1. Re: Conditional filling field value in EL
          pbaker01

          Hi Chris, 

          I could not understand your question, could reword it?

          I've been using the autocomplete and if a single space is entered then no selections are going to be shown.

          Your example shows a single space, it is not an empty string....

          It's not clear to me what you are trying to do here. 

          onfocus="#{rich:component('region')}.setValue(' ');" is not the same as

          onfocus="#{rich:component('region')}.setValue('');"

           

           

          • 2. Re: Conditional filling field value in EL
            bleathem

            How about a getValue() call? as in:

            onfocus="#{empty rich:component('institutionName')}.getValue() ? #{rich:component('institutionName')}.setValue(' ');"

            • 3. Re: Conditional filling field value in EL
              wrdlprmpft

              Thanks, Paul, for your reply.

              Indeed I found that entering a single space is a work around to RF-12152, which means that it triggers the autocomplete. Admittedly I confounded single space and empty string in my question. With the answer by Brian, my question is answered now.