modalPanel 内にこの inputTextarea があり、バッキング Bean のそれぞれの値 (motivePopupMotive) を更新する唯一の方法は、inputTextarea に a4j:support を追加して、次のように ajaxSingle=true を設定することです。
<a4j:support event="onchange" ajaxSingle="true"></a4j:support>
メソッドを呼び出す前に、ボタン「btnSavePopupMotive」をクリックして保存します。これを行わないと、「btnSavePopupMotive」ボタンをクリックしたときのバッキング Bean の値は常に空の文字列になります。
しかし、このソリューションは必要ありません。なぜなら、ajax 関数を呼び出すと「読み込み中」の画像が表示され、ユーザーがこの入力にテキストを入力したからといって、この画像を表示したくないからです。どうすればこれを解決できますか?コードは次のとおりです。
<div style="position: absolute;">
<a4j:form id="form2">
<r:modalPanel id="panelPopupMotive" resizeable="false" autosized="true" minWidth="300" minHeight="20" >
<table width="99%" bgcolor="#FFFFFF" style="border-collapse: collapse; border: 0px solid #000000;">
<tr><td>
<fieldset>
<legend class="fmeSmallLegend"><h:outputText value="Motive" /> </legend>
<table><tr><td>
<h:inputTextarea id="motivePopupMotive"
onkeydown="verifySize(this, 200);"
onkeyup="verifySize(this, 200);"
onchange="verifySize(this, 200);"
value="#{ParameterFaces.motivePopupMotive}"
rows="4" style="width: 380px;" onfocus="this.style.background='#FFFED2';" onblur="this.style.background='#F5F5F5';">
</h:inputTextarea>
</td></tr></table>
</fieldset>
</td></tr>
<tr>
<td align="center">
<a4j:commandButton id="btnSavePopupMotive"
value="Save" onclick="saveMotive();"
style="width:80px" type="submit"
oncomplete="closePopupMotive();"
title="Save" reRender="motivePopupMotive,existsErrorMotive">
</a4j:commandButton>
<r:spacer width="5px" />
<a4j:commandButton id="btnCancel"
value="Cancel" style="width:80px"
oncomplete="Richfaces.hideModalPanel('panelPopupMotive');"
title="Cancel">
</a4j:commandButton>
</td>
</tr>
</table>
<script type="text/javascript">
function closePopupMotive(){
if (document.getElementById('form2:motivePopupMotive').value == 'false'){
Richfaces.hideModalPanel('panelPopupMotive');
}
}
</script>
<a4j:jsFunction name="saveMotive" reRender="motivePopupMotive" oncomplete="saveValidatedMotive();"/>
<a4j:jsFunction name="saveValidatedMotive" actionListener="#{ParameterFaces.save}" reRender=""/>
</r:modalPanel>
</a4j:form>
</div>
ありがとう!!