Skip to main content

Completing the Order

The <form> tag controls the behavior of the form. We have added an action attribute whose value specifies that the form's data should be sent to the TicketConfirm class on the server. We have also added a method attribute with value post which specifies how the browser should transmit the form data to the server.

The last thing we need to do is add a button labeled “Complete Order” to our form. This is accomplished with an <input type="submit" > tag.

What happens when the user clicks on this button? The form is submitted to TicketConfirm.

<html> <head></head>
<csp:class super="%CSP.Page,Cinema.Utils">
<csp:if condition='$D(%session.Data("Order"))'>
    <img src="YourTicketOrder.gif"><br>
    <script language="cache" runat="server">
        // Open Order object for display
        Set ord = ##class(Cinema.TicketOrder).%OpenId(%session.Data("Order"))
    <form method="post" action="Cinema.TicketConfirm.cls" name="OrderTickets">
    <csp:loop counter="num" from=1 to=#(ord.Items.Count())#>
        <script language="cache" runat="server">
            Set itm = ord.Items.GetAt(num)
       For the #($ZT(itm.Show.StartTime,4))#
        showing of #(itm.Show.Film.Title)#
        at #(itm.Show.Theater.TheaterName)#
        <select name="AdultTickets">
        <select name="ChildTickets">
    Total Charge:
    <input type="text" name="TotalCharge" size=5 readonly
        value=#($FN(ord.Total, "", 2))#> <br><br>
    <input type="submit" name="CompleteOrder" value="Complete Order">

</body> </html>
FeedbackOpens in a new tab