1 Reply Latest reply on Nov 10, 2008 9:37 PM by Nick Belaevski

    rich:modalPopup and enter key

    null null Novice

      I am using richfaces modalPopup with a form(form is outside another form on the page). When I hit enter while the modalPopup is up, it submits the other form and reloads the page and my popup goes away. I want instead to put the focus on the input text and the enter key to submit the modalPopup form. It all works GREAT if just using the mouse. Just the enter key is broken.

      I tried calling focus on the input box and when stepping through firebug, I see that it works for a millisecond and then the focus goes elsewhere but I have no idea why? How to control the focus on modalPanel? I thought it might work by default but doesn't.

       function show(){
      183 Richfaces.showModalPanel('mp');
      184 var theInput = document.getElementById("temp:nameForm:newNameDecorate:newPageName");
      185 theInput.value='';
      186 var field = document.getElementById('temp:nameForm:newNameDecorate:newPageName');
      187 field.focus();
      188 return false;
      189 };