6 Replies Latest reply on Mar 28, 2011 3:11 AM by deeps p

    Backspace issue in rich:comboBox

    deeps p Newbie

      Hi,

       

      When the backspace button is pressed inside a rich:comboBox the web page is navigating to the previous page.Is there any way to disable this? I tried giving the following :

       

      <rich:hotKey key="backspace"

      disableInInput="true"

      handler="alert('Backspace is disabled'); event.stopPropagation(); event.preventDefault(); return false;" />

       

      But rich hot key seems to be not working with combobox.I have seen some issue also related to this.

       

      So can u please suggest me any solution for this.

      Thanks,

      Deeps.

        • 1. Backspace issue in rich:comboBox
          Ilya Shaikovsky Master

          disableInInput="true" - should be false. if true hotKey not working in inputs.

          • 2. Backspace issue in rich:comboBox
            deeps p Newbie

            Tried giving

             

            <rich:hotKey key="backspace" disableInInput="false"

                                                                                                                                              handler="alert('Backspace is disabled'); event.stopPropagation(); event.preventDefault(); return false;" />

             

            and

             

            <rich:hotKey key="backspace" disableInInput="false"

                                                                                                                                              handler="alert('Backspace is disabled');return false;" />

             

            just after the combo box.

             

            but it didnt work.Even the alert is not coming.

             

            Deeps.

            • 3. Backspace issue in rich:comboBox
              Ilya Shaikovsky Master

              does it work in other inputs?

              • 4. Backspace issue in rich:comboBox
                Ilya Shaikovsky Master

                and b.t.w. which version used? seems I remember some such issue.. but not sure if we worked on it..

                • 5. Backspace issue in rich:comboBox
                  Sascha Janz Master

                  we got the same issue.

                   

                  i use a little javascript to solve this.

                   

                   

                  combo.setOnkeypress(
                  "if (event.keyCode == 8 || event.keyCode==110 || event.keyCode==46 ){ if(document.getElementById('id_of_combo' +'comboboxField') != null )document.getElementById('id_of_combo' +'comboboxField').value=''; return false; }"

                  );

                   

                  it work's fine

                   

                   

                  • 6. Backspace issue in rich:comboBox
                    deeps p Newbie

                    The issue is there for combo boxes and text boxes have no issues.I tried the above solution ,but onkeypress event is not getting triggered for bacspace key.So I tried with onkeydown for which the javascript funtion is getting called.But then it will navigate to the previous page after calling the function.So I added event.stopPropagation(); and event.preventDefault(); in the js function.Still it is not working.

                     

                    My js is :-

                     

                    function disableBackSpace(event)

                                {

                                    event.stopPropagation();

                                    event.preventDefault();

                                    return false;

                                }

                    The hotkey solution seems to be not working with combobox.Can any one please sugget any solution for avoiding previous page navigation when bacspace is pressed inside an input field(combobox).

                     

                    Thanks,

                    Deeps.