10 Replies Latest reply on Jul 25, 2014 5:32 AM by Tai N.

    how to do autocomplete="off" for rich:calendar

    Saroj Padhy Novice

      Hi All,

       

      I am able to specify autocomplete="off" for jsf inputtext component.

      But rich:calendar i need this, so that i can disable the browser auto suggestions from history.

       

      I did not find this attribute in rich:calendar.

       

      How to disable autocomplete for rich:calendar?

       

      Note: I tried using javascript method to set this attribute, on oninputfocus event, but this fails for the first time focus and works later on.

      I need a proper solution for this.

       

      Thanks in advance.

      Saroj (aka Sarocks)

        • 1. Re: how to do autocomplete="off" for rich:calendar
          Siva P Master

          try like this,

           

           

          <rich:calendar id="searchingDateToField" styleClass="celcom01" inputClass="celcom01"
          value="#{transactionListBean.tnx_EndDate_Search}"
          locale="en/US" popup="true" datePattern="dd/MM/yyyy"
          showApplyButton="false" cellWidth="24px" inputSize="11"
          cellHeight="22px" style="width:200px"
          >

          <rich:calendar id="searchingField" value="#{Beanname.fieldVariable}"

                locale="en/US" popup="true" datePattern="dd/MM/yyyy"

                showApplyButton="false" cellWidth="24px" inputSize="11"

                                cellHeight="22px" style="width:200px">

          </rich:calendar>


          • 2. Re: how to do autocomplete="off" for rich:calendar
            Saroj Padhy Novice

            Hi Sivaprasad,

             

            I did not find any solution to my problem.

            I need to disable autocomplete for rich:calendar input field.

             

            Note: It happens only in mozilla browser, the inputs made to the input field previously is getting displayed as a dropdown box, which i need to disable.

             

            Here is a screenshot of the issue:

            snapshot.JPG

            Anyway,

            Thanks for the reply.

            Saroj

            • 3. Re: how to do autocomplete="off" for rich:calendar
              Saroj Padhy Novice

              I am still looking for an answer to the above issue

               

              Thanks,

              Saroj

              • 4. Re: how to do autocomplete="off" for rich:calendar
                Akaine Harga Novice

                It's a browser's feature and is not related to JSF or RF.

                The feature can be turned off by editing userChrome.css manually:

                - http://lifehacker.com/197715/customize-firefox-with-userchromecss

                - http://www.mozilla.org/unix/customizing.html

                - http://kb.mozillazine.org/Disabling_autocomplete_-_Firefox#Firefox_3.5

                 

                Though if you want to prevent this behavior for all users - it's impossible.

                • 5. Re: how to do autocomplete="off" for rich:calendar
                  Saroj Padhy Novice

                  I hope there would be a solution for this.

                  Becasue for h:inputtext we can able to disable autocomplete feature irrespective of different type of browsers.

                  And rich:calendar is also an input type.

                   

                  I also tried calling a javascript as below:

                   

                  <script type="text/javascript">

                  function disableAutocomplete(obj)

                  {

                     obj.setAttribute('autocomplete','off');

                  }

                  </script>


                  <rich:calendar ...

                       oninputfocus="disableAutocomplete(this);"/>

                   

                   

                  Now, on first time focusing on rich:calendar, the previously entered values displaying in drowndown box (which it shoudn't do). But second time onwards focusing on the rich:calendar, the problem is getting solved. Now i don't know how to disable this for the first time focus also

                   

                  And as I have used lots of rich:calendar in my page and rich:calendar getting created dynamically in a grid box, I can't call the script on onloadof the page.

                   

                  I need a proper solution for this issue.

                  Thanks in advance,

                  Saroj

                  • 6. Re: how to do autocomplete="off" for rich:calendar
                    Siva P Master

                    I tried with this code it is working in Mozilla,

                     

                    <h:outputText value="From" />

                    <rich:calendar id="searchingDateFromField" styleClass="celcom01" inputClass="celcom01"

                       value="#{transactionListBean.tnx_StartDate_Search}"

                       locale="en/US" popup="true" datePattern="dd/MM/yyyy HH:mm"

                       showApplyButton="false" cellWidth="24px" inputSize="11" mode="client"

                       cellHeight="22px" style="width:200px" enableManualInput="true"

                       oninputmouseover="disableAutocomplete(this);">

                    </rich:calendar>

                     

                    <script type="text/javascript">

                    function disableAutocomplete(obj)

                    {

                     

                       obj.setAttribute('autocomplete','off');

                    }

                    </script>

                     

                    It is working for me and i have attached Image also.In From data rich:calender box if u double click then only it will show the autocomplete or you have to type.so there it will clear the values like OFF.

                    NewDateModelIMG.JPG

                     

                    <h:outputText value="From" />
                    <rich:calendar id="searchingDateFromField" styleClass="celcom01" inputClass="celcom01"
                    value="#{transactionListBean.tnx_StartDate_Search}"
                    locale="en/US" popup="true" datePattern="dd/MM/yyyy HH:mm"
                    showApplyButton="false" cellWidth="24px" inputSize="11" mode="client"
                    cellHeight="22px" style="width:200px" enableManualInput="true"
                    oninputmouseover="disableAutocomplete(this);">
                    </rich:calendar>

                    1 of 1 people found this helpful
                    • 7. Re: how to do autocomplete="off" for rich:calendar
                      Saroj Padhy Novice

                      Hi Sivaprasad,

                       

                      Your solution is helpful. Now when we reach calendar by mouse, it's not showing the history in dropdown (nice trick of oninputmouseover). But now if we reach the calendar by keyboard control (Tab button), I am facing same issue, (with keyboard Arrow key down button, I am getting history in dropdown box).

                       

                      I tried with "oninputkeydown" etc. without any success.

                       

                      Need a permanent and good solution for this.

                       

                      Thanks,
                      Saroj

                      • 8. Re: how to do autocomplete="off" for rich:calendar
                        Siva P Master

                        Hi Saroj,

                         

                        Yes i tried with these attributes also it is not working,May be this is Jboss bug in 3.3.3

                        oninputblur

                        oninputchange

                        oninputfocus  ---- Not working

                        oninputkeydown

                        onfocus ---- NO attribute in the rich:calendar

                         

                        It is not working..

                         

                        oninputblur
                        oninputchange
                        oninputfocus
                        oninputkeydown

                        • 9. Re: how to do autocomplete="off" for rich:calendar
                          Saroj Padhy Novice

                          Hi All,

                           

                          Still waiting for a proper solution to this issue.

                           

                          Thanks in advance,

                          Saroj

                          • 10. Re: how to do autocomplete="off" for rich:calendar
                            Tai N. Newbie

                            Hi,

                            I used the javascript to disable auto complete it.

                            <script>

                               document.getElementById('mainForm:calInputDate').setAttribute('autocomplete','off');

                            </script>