JavaScript での xfa.event.change の操作(LiveCycle デザイナー)

問題点

次のコードで示すように、xfa.event.newText を使用してフィールドを制限しようとすると、これが機能しなくなります。

console.show(); console.println("new text is: " + xfa.event.newText); console.println("old text is: " + xfa.event.prevText); console.println("new text length: " + xfa.event.newText.toString().length); if (xfa.event.newText.toString().length > 9) { console.println( "new text is longer than 9"); this.rawValue = xfa.event.prevText; } console.println("");

変更しようとしている可能性があります :

this.rawValue = xfa.event.prevText

xfa.event.newText = xfa.event.prevText

ただし、これは機能せずに、TextField は 9 文字に制限されます。

解決策

これは動作コードで、TextField を 9文字に制限するコードの変更を強調表示しています。

console.show(); console.println("new text is: " + xfa.event.newText); console.println("old text is: " + xfa.event.prevText); console.println("change is: " + xfa.event.change); console.println("new text length: " + xfa.event.newText.toString().length); if (xfa.event.newText.toString().length > 9) { console.println("new text is longer than 9"); xfa.event.change = ""; } console.println("");

ヘルプをすばやく簡単に入手

新規ユーザーの場合