Skip to main content

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.

<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"))
    <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">
            <csp:loop counter="i" from=0 to=9>
                <option> #(i)# </option>
        </select>Adult Tickets<br>

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