Skip to main content

BIN rfGz4 Documentation

  • Author:

  • Version: 19

  • Description: Example of credit card form, Bad Design: Expiration Date as a gYearMonth, do not use. The constraint transforms a gYearMonth to a date with string concatenation..

  • Created: 2014-09-21

  • Modified: 2021-01-23

  • Source:

     Edit Bin W3C Schema Json-Schema Java Bean Code Default Value as XML

    Printers Embed Responsive

    <complexType name='CreditCard'
    		description='Example of credit card form, Bad Design: Expiration Date as a gYearMonth, do not use. The constraint transforms a gYearMonth to a date with string concatenation..'>
        <field name='NameOnCard' type='xs:string' >
            <facet name='minLength' value='2'/>
        </field>
        <field name='CardNumber' type='xs:NMTOKEN' 
    			extra:form.control='CreditCardNumber'>
            <facet name='length' value='16'/>
        </field>
        <field name='ValidTo' type='xs:gYearMonth' />
        <field name='CVV' type='xs:string'   caption='CVV Security Code'
    	    	    		extra:ic.css='input-mini'
    	    	    		extra:html5.inputmode='numeric'
    	    	    		extra:ctrl.prefix='&lt;div class="input-append">'
    	    	    		extra:ctrl.suffix='&amp;nbsp;&lt;a class="add-on" href="http://www.cvvnumber.com/cvv.html" target="_blank" style="font-size:11px;white-space:nowrap;">What is my CVV code?&lt;/a>&lt;/div>'
    	    	    		extra:html5.type='text' >
            <facet name='minLength' value='3'/>
            <facet name='maxLength' value='4'/>
            <facet name='pattern' value='[0-9][0-9][0-9][0-9]?'/>
        </field>
        <constraint name='ValidToExpired' category='boolean' selector='.'>
            	<expression grammar='xpath'
                 path='op:date-greater-than(op:add-yearMonthDuration-to-date(xs:date(fn:concat(xs:string(ValidTo),"-01")), xs:yearMonthDuration("P0Y1M")) ,
                 fn:current-date() )' />
    
        </constraint>
    </complexType>