Skip to main content

This version of the product is no longer supported, and this documentation is no longer updated regularly. See the latest version of this content.Opens in a new tab

Adding a Drop Down List

Next, we would like to add two drop down lists that enable the user to select the number of adult and child tickets. (Only adult is shown here, to save space.)

We begin by adding a <select> tag, which is what HTML uses for lists. Within the <select> there is an <option> tag for each entry in the list. We allow up to nine tickets to be purchased, so we use a <csp:loop> tag to generate ten entries.

—Order.csp—
Order.csp
<html> <head></head>
<body>
<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"))
    </script>
    <csp:loop counter="num" from=1 to=#( ord.Items.Count() )#>
        <script language="cache" runat="server">
            Set itm = ord.Items.GetAt(num)
        </script>
        For the #($ZT(itm.Show.StartTime,4))#
        showing of #(itm.Show.Film.Title)#
        at #(itm.Show.Theater.TheaterName)#
        <br><br>
        <select name="AdultTickets">
            <csp:loop counter="i" from=0 to=9>
                <option> #(i)# </option>
            </csp:loop>
        </select>Adult Tickets<br>

    </csp:loop>
</csp:if>
</body> </html>
FeedbackOpens in a new tab