onfocus - フォーカスオンスクリプト

コントロールにフォーカスが移動したときに、イベントハンドラを有効にします。

カテゴリ

イベント

構文

<xp:eventHandler event="onfocus" attributes>content</xp:eventHandler>

使用法

イベントハンドラの構文の詳細については、eventHandler - イベントハンドラ (プロパティ) を参照してください。

この入力ボックスは、onfocus イベントのクライアントハンドラとサーバーハンドラの両方を保有します。 最初に、クライアントハンドラが実行されます。 confirm ステートメントが true を返した場合 (ユーザーの応答が OK の場合)、サーバーハンドラが実行されます。
<xp:inputText id="inputText2">
	<xp:eventHandler event="onfocus" submit="true"
		refreshMode="complete">
		<xp:this.action>
			<![CDATA[#{javascript:requestScope.status = "Input box on focus"}]]>
		</xp:this.action>
		<xp:this.script>
			<![CDATA[return confirm("Do you want to submit?")]]>
		</xp:this.script>
	</xp:eventHandler>
</xp:inputText>