Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

ChangeQuantity メソッドの呼び出し

最後のステップは、onChange イベントが発生したときに、このメソッドを呼び出す Orders ページを更新することです。3 つの引数が、サーバ側のメソッド ChangeQuantity に渡されます。3 つの引数とは、TicketItem オブジェクトの数、大人用チケットを示す 1 または子供用チケットを示す 2、JavaScript コード “this.selectedIndex” で取得する、新しく選択されたチケットの枚数です。JavaScript での this は、現在のオブジェクトを指します。この場合、どちらのドロップダウン・リストで onChange イベントが発生したかを表します。

—Order.csp—
Order.csp
<html> <head></head>
<body>
    ...
    <csp:loop counter="num" from=1 to=#(ord.Items.Count() )#>
        <select name="AdultTickets"
        OnChange="#server(..ChangeQuantity( #(num)#, 1, this.selectedIndex) )#">
        ...
        </select>Adult Tickets<br>

        <select name="ChildTickets"
        OnChange="#server(..ChangeQuantity( #(num)#, 2, this.selectedIndex) )#">
        ...
        </select>Child Tickets<br>

    </csp:loop>
    ...
</body> </html>
Note:

このチュートリアルを次に進む場合は、ここをクリックしてください。

FeedbackOpens in a new tab