2011-11-23 74 views
0

我有一個富文本編輯器一個非常簡單的彈出窗口:將焦點設置到豐富:編輯在豐富:modalPanel當模式面板彈出

<rich:modalPanel id="commentFormPanel" width="640" height="480"> 
    <f:facet name="header"> 
     <h:panelGroup>Comment</h:panelGroup> 
    </f:facet> 
    <h:form id="commentForm"> 
     <rich:editor id="commentContent" width="620" height="440" 
      theme="simple" viewMode="visual" 
      value="#{commentHome.content}" /> 
    </h:form> 
</rich:modalPanel> 

是否有可能將焦點設置在富人:編輯時模態面板彈出?

有人建議使用這樣的:

tinyMCE.execCommand('mceFocus',false,'commentForm:commentContent'); 

我試過,但沒有奏效。有沒有人有辦法解決嗎?謝謝。

更新:

我試了幾件事情:

一)。

<rich:editor id="commentContent" width="620" height="440" 
    theme="simple" viewMode="visual"> 
    <f:param name="auto_focus" value="commentForm:commentContent" /> 
</rich:editor> 

b)。

<rich:modalPanel onshow="tinyMCE.get('commentForm:commentContent').focus();"> 

都沒有工作。

回答

1

這將工作:

 <rich:editor id="commentContent" width="620" height="440" 
      theme="simple" viewMode="visual" useSeamText="false" 
      value="#{commentHome.content}" 
      oninit="setTimeout(function() { tinyMCE.execCommand('mceFocus',false,'commentForm:commentContentTextArea'); }, 1);" /> 
+0

謝謝馬克。你是明星。 –

0
<rich:jQuery query="focus().select()" selector="#commentContent" name="focusInput"/> 

<script> 
    focusInput(); 
</script> 
+0

謝謝拉敏,我想你的代碼,但對富人沒有工作:編輯。如果我使用h:inputTextarea或h:inputText,則代碼運行良好。 –

0

添加標籤domElementAttachment = 「父母」,以豐富:modalPanel