开发者

Backspace Hotkey does not work in Richfaces Modal

开发者 https://www.devze.com 2023-02-20 09:22 出处:网络
I have added the following to my pages (to prevent users been able to use the backspace function th开发者_运维技巧roughout the site):

I have added the following to my pages (to prevent users been able to use the backspace function th开发者_运维技巧roughout the site):

<rich:hotKey key="backspace" handler="return false;" disableInInput="true" />

It works fine on the page that generates the popup modal, but when the modal is shown the hotkey will not work on the modal screen:

<rich:modalPanel id="mpTest" minWidth="325" minHeight="225" zindex="2000">
 .....
</rich:modalPanel>

Do I need to do something differently for a modal screen?

Edit

Ok, so it looks like it has something to do with the pop up modal not having focus. If I click anywhere in the modal panel and then press the backspace, the backspace is disabled and all works well.

So I'm thinking I need to somehow set the focus on modal panel when it's displayed. Problem is, I only have one textarea element in it and this is readonly (So I do not want to put focus on this). I cant seem to set the focus on non-form input type elements i.e.

<rich:hotKey key="backspace" handler="return false;" disableInInput="true" />

<rich:modalPanel id="mpTest" minWidth="325" minHeight="225" zindex="2000" showWhenRendered="true" onshow="document.getElementById('mpTest').focus();">
     <h:inputTextarea id="description" ....>
</rich:modalPanel>

Any suggestions?

0

精彩评论

暂无评论...
验证码 换一张
取 消