<?xml-stylesheet type="text/xsl" href="/xforms-tests/xsltforms/xsltforms.xsl"?>
<html xmlns:my="http://commerce.example.com/payment" xmlns:txs="http://sourceforge.net/projects/txs" xmlns="http://www.w3.org/1999/xhtml" xmlns:req="http://www.agencexml.com/requests" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:hlp="http://commerce.example.com/help" xmlns:xhtml="http://www.w3.org/1999/xhtml">
    <head>
        <title>2.4.a Example: Multiple Forms</title>
        <link rel="stylesheet" href="../driverPages/forms/TestSuite11.css" type="text/css"/>
        <xforms:model id="pay">
            <xforms:instance>
                <my:payment xmlns="http://commerce.example.com/payment" method="cc">
                    <my:number/>
                    <my:expiry/>
                </my:payment>
            </xforms:instance>
            <xforms:submission id="submit01" method="post" action="http://www.agencexml.com/xforms-tests/xsltforms/echo.php"/>
            <xforms:bind nodeset="/my:payment/my:number" relevant="/my:payment/@method = 'cc'" required="/my:payment/@method='cc'" type="my:ccnumber"/>
            <xforms:bind nodeset="/my:payment/my:expiry" relevant="/my:payment/@method = 'cc'" required="/my:payment/@method='cc'" type="xsd:gYearMonth"/>
            <xsd:schema targetNamespace="http://commerce.example.com/payment">
                <xsd:simpleType name="ccnumber">
                    <xsd:restriction base="xsd:string">
                        <xsd:pattern value="\d{14,18}"/>
                    </xsd:restriction>
                </xsd:simpleType>
                <xsd:element name="payment">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="number" type="my:ccnumber" minOccurs="0"/>
                            <xsd:element name="expiry" type="xsd:gYearMonth" minOccurs="0"/>
                        </xsd:sequence>
                        <xsd:attribute name="method" type="xsd:string"/>
                    </xsd:complexType>
                </xsd:element>
            </xsd:schema>
        </xforms:model>
        <xforms:model id="poll">
            <xforms:instance>
                <hlp:helpmodel xmlns="http://commerce.example.com/help">
                    <hlp:helpful>3</hlp:helpful>
                </hlp:helpmodel>
            </xforms:instance>
            <xforms:submission id="pollsubmit" method="post" action="http://www.agencexml.com/xforms-tests/xsltforms/echo.php"/>
        </xforms:model>
    </head>
    <body>
        <xforms:group>
            <xforms:label class="title">2.4.a Example: Multiple Forms</xforms:label>
        </xforms:group>
        <xforms:group>
            <xforms:label>
                You must see a select1 control with the values "Cash" and "Credit" as well as two 
                input controls on the page. 
                The Credit Card Number and Expiration Date input controls are set to be relevant only when Credit 
                is selected. If you have selected Cash then you must be able to submit the form 
            	and the input controls must have become unavailable. 
            </xforms:label>
        </xforms:group>
        <xforms:group>
            <xforms:label>
            	If you have selected Credit then you must not be able to submit the form until valid data is 
            	entered into both input controls. A valid entry for Credit Card Number is a positive number with 
            	14-18 digits. A valid entry for the expiration date 
            	is a date in the format of gYearMonth, which is yyyy-mm (ex. 1998-12 for December 1998).
            </xforms:label>
        </xforms:group>
        <xforms:group>
        	<xforms:label>
        		When you activate the Submit Form 1 submit control this page must be replaced by the form data. 
				You must see the value "cc" and the values you entered in the Credit 
				Card Number and Expiration Date input controls if you had selected Credit or the 
                value "cash" if you had selected Cash. 
        	</xforms:label>
        </xforms:group>
        <xforms:select1 ref="@method" model="pay">
            <xforms:label>Select Payment Method:</xforms:label>
            <xforms:item>
                <xforms:label>Cash</xforms:label>
                <xforms:value>cash</xforms:value>
            </xforms:item>
            <xforms:item>
                <xforms:label>Credit</xforms:label>
                <xforms:value>cc</xforms:value>
            </xforms:item>
        </xforms:select1>
        <xforms:input ref="my:number" model="pay">
            <xforms:label>Credit Card Number:</xforms:label>
        </xforms:input>
        <xforms:input ref="/my:payment/my:expiry" model="pay">
            <xforms:label>Expiration Date:</xforms:label>
        </xforms:input>
        <xforms:submit submission="submit01">
            <xforms:label>Submit Form 1</xforms:label>
        </xforms:submit>
        <xforms:group>
            <xforms:label>
                You must see a select1 with four different options (Not at all helpful, Barely
                helpful, Somewhat helpful, and Very helpful). When you activate the 'Submit Form 2'
                trigger a data instance must appear with a number corresponding to the value you chose 
                (0-3) under 'helpful'.
            </xforms:label>
        </xforms:group>
        <xforms:select1 ref="hlp:helpful" model="poll">
            <xforms:label>How useful is this page to you?</xforms:label>
            <xforms:item>
                <xforms:label>Not at all helpful (0)</xforms:label>
                <xforms:value>0</xforms:value>
            </xforms:item>
            <xforms:item>
                <xforms:label>Barely helpful (1)</xforms:label>
                <xforms:value>1</xforms:value>
            </xforms:item>
            <xforms:item>
                <xforms:label>Somewhat helpful (2)</xforms:label>
                <xforms:value>2</xforms:value>
            </xforms:item>
            <xforms:item>
                <xforms:label>Very helpful (3)</xforms:label>
                <xforms:value>3</xforms:value>
            </xforms:item>
        </xforms:select1>
        <xforms:submit submission="pollsubmit" model="poll">
            <xforms:label>Submit Form 2</xforms:label>
        </xforms:submit>
        <xforms:group>
        	<xforms:lable>
        		IMPORTANT: Note that 'Submit Form 1' and 'Submit Form 2' only submit the data on the page to which they 
        		are linked to.  'Submit Form 1' must only submit the data for the payment information and 'Submit 
        		Form 2' must only submit the data for the page survey.
        	</xforms:lable>
        </xforms:group>
    </body>
</html>
