XForms two dates validation

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

XForms two dates validation

zuczek .
Hi
  I'm trying to write a form that validates two dates to check if the
end date wasn't earlier than start date. I'm wondering if I'm doing
something wrong on my side or there're some bugs in mozilla xforms
extension that causes that / functionality is not implemented yet. I'm
attaching full code.
I'd appreciate some help. Keep up the good work guys!.


<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/
2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events">
   <head>
      <title>Xforms</title>
      <style type="text/css">
         body {font-family: Helvetica, sans-serif}
         *:required {background-color: yellow;}
         *:invalid  { background-color: pink;}
    </style>


      <model xmlns="http://www.w3.org/2002/xforms"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi=
         "http://www.w3.org/2001/XMLSchema-instance">
         <instance>
            <trip xmlns="">
               <start xsi:type="xsd:date">2010-10-10</start>
               <end xsi:type="xsd:date">2010-10-30</end>
            </trip></instance>
         <bind nodeset="/travel">
            <bind nodeset="return"
               constraint="days-from-date(end)
               - days-from-date(start) &gt; 0"/>
         </bind>
      </model>
   </head>
   <body>
      <xf:label>Trying to do validation that checks if end date is
greater than start date.</xf:label><br/><br/>
      <xf:input ref="start" incremental="true">
         <xf:label>Starting date</xf:label>
      </xf:input>
      <br/><br/>
      <xf:input ref="end" incremental="true">
         <xf:label>Ending date</xf:label>
      </xf:input>

   </body>
   </html>
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XForms two dates validation

RajaM-2
On Oct 27, 12:28 am, "zuczek ." <[hidden email]> wrote:

> Hi
>   I'm trying to write a form that validates two dates to check if the
> end date wasn't earlier than start date. I'm wondering if I'm doing
> something wrong on my side or there're some bugs in mozilla xforms
> extension that causes that / functionality is not implemented yet. I'm
> attaching full code.
> I'd appreciate some help. Keep up the good work guys!.
>
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/
> 2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ev="http://www.w3.org/2001/xml-events">
>    <head>
>       <title>Xforms</title>
>       <style type="text/css">
>          body {font-family: Helvetica, sans-serif}
>          *:required {background-color: yellow;}
>          *:invalid  { background-color: pink;}
>     </style>
>
>       <model xmlns="http://www.w3.org/2002/xforms"
>          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>          xmlns:xsi=
>          "http://www.w3.org/2001/XMLSchema-instance">
>          <instance>
>             <trip xmlns="">
>                <start xsi:type="xsd:date">2010-10-10</start>
>                <end xsi:type="xsd:date">2010-10-30</end>
>             </trip></instance>
>          <bind nodeset="/travel">
>             <bind nodeset="return"
>                constraint="days-from-date(end)
>                - days-from-date(start) &gt; 0"/>
>          </bind>
>       </model>
>    </head>
>    <body>
>       <xf:label>Trying to do validation that checks if end date is
> greater than start date.</xf:label><br/><br/>
>       <xf:input ref="start" incremental="true">
>          <xf:label>Starting date</xf:label>
>       </xf:input>
>       <br/><br/>
>       <xf:input ref="end" incremental="true">
>          <xf:label>Ending date</xf:label>
>       </xf:input>
>
>    </body>
>    </html>

Hi zuczek!!!

Your form have small small mistakes, So, see the modified version of
the code ,


<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ev="http://www.w3.org/2001/xml-events">

  <head>
      <title>Xforms</title>
              <style type="text/css">
                body {font-family: Helvetica, sans-serif}
                *:required {background-color: yellow;}
                *:invalid  { background-color: pink;}
              </style>

      <xf:model>

                <xf:instance>
                    <trip xmlns="">
                      <start xsi:type="xs:date">2010-10-10</start>
                      <end xsi:type="xs:date">2010-10-30</end>
                        <return/>
                    </trip>
                </xf:instance>

                    <xf:bind nodeset="start" type="xs:date"/>
                    <xf:bind nodeset="end" type="xs:date"/>
                    <xf:bind nodeset="return" calculate="if((0 &lt; days-from-
date(end) - days-from-date(start)), 'Valid Date','Date Invalid')"/>
      </xf:model>
  </head>

  <body>
      <xf:label>Trying to do validation that checks if end date is
greater than start date.</xf:label><br/><br/>

      <xf:input ref="start" incremental="true">
        <xf:label>Starting date</xf:label>
      </xf:input>
      <br/><br/>

      <xf:input ref="end" incremental="true">
        <xf:label>Ending date</xf:label>
      </xf:input>
        <!--<xf:action ev:event="xforms-value-changed" if="">
                <xf:message level="modal">Valid Date</xf:message>
        </xf:action>
        <xf:action ev:event="xforms-value-changed" if="days-from-date(end)-
days-from-date(start) &lt; 0">
                <xf:message level="modal">InValid Date</xf:message>
        </xf:action>--><br/><br/>
        <xf:output value="if((0 &lt; days-from-date(end) - days-from-
date(start)), 'Valid Date','Date Invalid')"><xf:label>Your Date::</
xf:label></xf:output>


  </body>
  </html>

By
Rajamani marimuthu and Vivek
OTC
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XForms two dates validation

zuczek .
On Oct 27, 8:12 am, RajaM <[hidden email]> wrote:

> On Oct 27, 12:28 am, "zuczek ." <[hidden email]> wrote:
>
>
>
>
>
>
>
>
>
> > Hi
> >   I'm trying to write a form that validates two dates to check if the
> > end date wasn't earlier than start date. I'm wondering if I'm doing
> > something wrong on my side or there're some bugs in mozilla xforms
> > extension that causes that / functionality is not implemented yet. I'm
> > attaching full code.
> > I'd appreciate some help. Keep up the good work guys!.
>
> > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/
> > 2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:ev="http://www.w3.org/2001/xml-events">
> >    <head>
> >       <title>Xforms</title>
> >       <style type="text/css">
> >          body {font-family: Helvetica, sans-serif}
> >          *:required {background-color: yellow;}
> >          *:invalid  { background-color: pink;}
> >     </style>
>
> >       <model xmlns="http://www.w3.org/2002/xforms"
> >          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >          xmlns:xsi=
> >          "http://www.w3.org/2001/XMLSchema-instance">
> >          <instance>
> >             <trip xmlns="">
> >                <start xsi:type="xsd:date">2010-10-10</start>
> >                <end xsi:type="xsd:date">2010-10-30</end>
> >             </trip></instance>
> >          <bind nodeset="/travel">
> >             <bind nodeset="return"
> >                constraint="days-from-date(end)
> >                - days-from-date(start) &gt; 0"/>
> >          </bind>
> >       </model>
> >    </head>
> >    <body>
> >       <xf:label>Trying to do validation that checks if end date is
> > greater than start date.</xf:label><br/><br/>
> >       <xf:input ref="start" incremental="true">
> >          <xf:label>Starting date</xf:label>
> >       </xf:input>
> >       <br/><br/>
> >       <xf:input ref="end" incremental="true">
> >          <xf:label>Ending date</xf:label>
> >       </xf:input>
>
> >    </body>
> >    </html>
>
> Hi zuczek!!!
>
> Your form have small small mistakes, So, see the modified version of
> the code ,
>
> <html xmlns="http://www.w3.org/1999/xhtml"
>       xmlns:xf="http://www.w3.org/2002/xforms"
>       xmlns:xs="http://www.w3.org/2001/XMLSchema"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xmlns:ev="http://www.w3.org/2001/xml-events">
>
>   <head>
>       <title>Xforms</title>
>               <style type="text/css">
>                 body {font-family: Helvetica, sans-serif}
>                 *:required {background-color: yellow;}
>                 *:invalid  { background-color: pink;}
>               </style>
>
>       <xf:model>
>
>                 <xf:instance>
>                     <trip xmlns="">
>                       <start xsi:type="xs:date">2010-10-10</start>
>                       <end xsi:type="xs:date">2010-10-30</end>
>                         <return/>
>                     </trip>
>                 </xf:instance>
>
>                     <xf:bind nodeset="start" type="xs:date"/>
>                     <xf:bind nodeset="end" type="xs:date"/>
>                     <xf:bind nodeset="return" calculate="if((0 &lt; days-from-
> date(end) - days-from-date(start)), 'Valid Date','Date Invalid')"/>
>       </xf:model>
>   </head>
>
>   <body>
>       <xf:label>Trying to do validation that checks if end date is
> greater than start date.</xf:label><br/><br/>
>
>       <xf:input ref="start" incremental="true">
>         <xf:label>Starting date</xf:label>
>       </xf:input>
>       <br/><br/>
>
>       <xf:input ref="end" incremental="true">
>         <xf:label>Ending date</xf:label>
>       </xf:input>
>         <!--<xf:action ev:event="xforms-value-changed" if="">
>                 <xf:message level="modal">Valid Date</xf:message>
>         </xf:action>
>         <xf:action ev:event="xforms-value-changed" if="days-from-date(end)-
> days-from-date(start) &lt; 0">
>                 <xf:message level="modal">InValid Date</xf:message>
>         </xf:action>--><br/><br/>
>         <xf:output value="if((0 &lt; days-from-date(end) - days-from-
> date(start)), 'Valid Date','Date Invalid')"><xf:label>Your Date::</
> xf:label></xf:output>
>
>   </body>
>   </html>
>
> By
> Rajamani marimuthu and Vivek
> OTC

Thanks a lot for your help! The code worked. Just one more question:
if two dates fail to validate is it possible to make my form
invalidate (the CSS pink color will be around the invalid control and
user won't be able to submit data ) ?
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XForms two dates validation

RajaM-2
On Oct 27, 11:48 am, "zuczek ." <[hidden email]> wrote:

> On Oct 27, 8:12 am, RajaM <[hidden email]> wrote:
>
>
>
> > On Oct 27, 12:28 am, "zuczek ." <[hidden email]> wrote:
>
> > > Hi
> > >   I'm trying to write a form that validates two dates to check if the
> > > end date wasn't earlier than start date. I'm wondering if I'm doing
> > > something wrong on my side or there're some bugs in mozilla xforms
> > > extension that causes that / functionality is not implemented yet. I'm
> > > attaching full code.
> > > I'd appreciate some help. Keep up the good work guys!.
>
> > > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/
> > > 2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > xmlns:ev="http://www.w3.org/2001/xml-events">
> > >    <head>
> > >       <title>Xforms</title>
> > >       <style type="text/css">
> > >          body {font-family: Helvetica, sans-serif}
> > >          *:required {background-color: yellow;}
> > >          *:invalid  { background-color: pink;}
> > >     </style>
>
> > >       <model xmlns="http://www.w3.org/2002/xforms"
> > >          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > >          xmlns:xsi=
> > >          "http://www.w3.org/2001/XMLSchema-instance">
> > >          <instance>
> > >             <trip xmlns="">
> > >                <start xsi:type="xsd:date">2010-10-10</start>
> > >                <end xsi:type="xsd:date">2010-10-30</end>
> > >             </trip></instance>
> > >          <bind nodeset="/travel">
> > >             <bind nodeset="return"
> > >                constraint="days-from-date(end)
> > >                - days-from-date(start) &gt; 0"/>
> > >          </bind>
> > >       </model>
> > >    </head>
> > >    <body>
> > >       <xf:label>Trying to do validation that checks if end date is
> > > greater than start date.</xf:label><br/><br/>
> > >       <xf:input ref="start" incremental="true">
> > >          <xf:label>Starting date</xf:label>
> > >       </xf:input>
> > >       <br/><br/>
> > >       <xf:input ref="end" incremental="true">
> > >          <xf:label>Ending date</xf:label>
> > >       </xf:input>
>
> > >    </body>
> > >    </html>
>
> > Hi zuczek!!!
>
> > Your form have small small mistakes, So, see the modified version of
> > the code ,
>
> > <html xmlns="http://www.w3.org/1999/xhtml"
> >       xmlns:xf="http://www.w3.org/2002/xforms"
> >       xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >       xmlns:ev="http://www.w3.org/2001/xml-events">
>
> >   <head>
> >       <title>Xforms</title>
> >               <style type="text/css">
> >                 body {font-family: Helvetica, sans-serif}
> >                 *:required {background-color: yellow;}
> >                 *:invalid  { background-color: pink;}
> >               </style>
>
> >       <xf:model>
>
> >                 <xf:instance>
> >                     <trip xmlns="">
> >                       <start xsi:type="xs:date">2010-10-10</start>
> >                       <end xsi:type="xs:date">2010-10-30</end>
> >                         <return/>
> >                     </trip>
> >                 </xf:instance>
>
> >                     <xf:bind nodeset="start" type="xs:date"/>
> >                     <xf:bind nodeset="end" type="xs:date"/>
> >                     <xf:bind nodeset="return" calculate="if((0 &lt; days-from-
> > date(end) - days-from-date(start)), 'Valid Date','Date Invalid')"/>
> >       </xf:model>
> >   </head>
>
> >   <body>
> >       <xf:label>Trying to do validation that checks if end date is
> > greater than start date.</xf:label><br/><br/>
>
> >       <xf:input ref="start" incremental="true">
> >         <xf:label>Starting date</xf:label>
> >       </xf:input>
> >       <br/><br/>
>
> >       <xf:input ref="end" incremental="true">
> >         <xf:label>Ending date</xf:label>
> >       </xf:input>
> >         <!--<xf:action ev:event="xforms-value-changed" if="">
> >                 <xf:message level="modal">Valid Date</xf:message>
> >         </xf:action>
> >         <xf:action ev:event="xforms-value-changed" if="days-from-date(end)-
> > days-from-date(start) &lt; 0">
> >                 <xf:message level="modal">InValid Date</xf:message>
> >         </xf:action>--><br/><br/>
> >         <xf:output value="if((0 &lt; days-from-date(end) - days-from-
> > date(start)), 'Valid Date','Date Invalid')"><xf:label>Your Date::</
> > xf:label></xf:output>
>
> >   </body>
> >   </html>
>
> > By
> > Rajamani marimuthu and Vivek
> > OTC
>
> Thanks a lot for your help! The code worked. Just one more question:
> if two dates fail to validate is it possible to make my form
> invalidate (the CSS pink color will be around the invalid control and
> user won't be able to submit data ) ?

Hi !!!

See the modified code for the valid and invalid representation ..


<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ev="http://www.w3.org/2001/xml-events">

  <head>
      <title>Xforms</title>
              <style type="text/css">
                @namespace xhtml url(http://www.w3.org/1999/xhtml);

                @namespace xf url(http://www.w3.org/2002/xforms);

                @namespace mozType url(http://www.mozilla.org/projects/xforms/2005/
type);
                body {font-family: Helvetica, sans-serif}
                *:required {background-color: yellow;}

                xf|input:invalid  { background-color: pink;}

              </style>

      <xf:model>

                <xf:instance id="default">
                    <trip xmlns="">
                      <start xsi:type="xs:date"></start>
                      <end xsi:type="xs:date"></end>
                        <return/>
                    </trip>
                </xf:instance>

                    <xf:bind id="snode" nodeset="instance('default')/start"
type="xs:date" required="true()" />
                    <xf:bind id="enode" nodeset="instance('default')/end"
type="xs:date" required="true()" calculate="if((days-from-
date(instance('default')/end) - days-from-date(instance('default')/
start)) &lt; 0 ,'',instance('default')/end)"/>
                <xf:submission id="save" method="put" action="result.xml">
                                <xf:message level="modal" ev:event="xforms-submit-done">Submit
Done</xf:message>
                                <xf:message level="modal" ev:event="xforms-submit-error">Submit
error</xf:message>
                </xf:submission>
      </xf:model>
  </head>

  <body>
      <xf:label>Trying to do validation that checks if end date is
greater than start date.</xf:label><br/><br/>

      <xf:input bind="snode" incremental="true">
        <xf:label>Starting date</xf:label>

      </xf:input>
      <br/><br/>

      <xf:input bind="enode" incremental="true">
        <xf:label>Ending date</xf:label>
                <xf:action ev:event="DOMFocusIn" if="days-from-date(end) - days-from-
date(start) &lt;0">
                        <xf:setvalue ref="end" value="''"/>
                </xf:action>
      </xf:input>
        <br/><br/>
        <xf:output value="if((0 &lt; days-from-date(end) - days-from-
date(start)), 'Valid Date','Date Invalid')"><xf:label>Your Date::</
xf:label></xf:output>
<br/>
<xf:submit submission="save">
        <xf:label>Save</xf:label>
</xf:submit>
  </body>
  </html>

By
Rajamani marimuthu and Vivek
XRX Team
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XForms two dates validation

zuczek .
On Oct 27, 12:59 pm, RajaM <[hidden email]> wrote:

> On Oct 27, 11:48 am, "zuczek ." <[hidden email]> wrote:
>
>
>
>
>
>
>
>
>
> > On Oct 27, 8:12 am, RajaM <[hidden email]> wrote:
>
> > > On Oct 27, 12:28 am, "zuczek ." <[hidden email]> wrote:
>
> > > > Hi
> > > >   I'm trying to write a form that validates two dates to check if the
> > > > end date wasn't earlier than start date. I'm wondering if I'm doing
> > > > something wrong on my side or there're some bugs in mozilla xforms
> > > > extension that causes that / functionality is not implemented yet. I'm
> > > > attaching full code.
> > > > I'd appreciate some help. Keep up the good work guys!.
>
> > > > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/
> > > > 2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > > xmlns:ev="http://www.w3.org/2001/xml-events">
> > > >    <head>
> > > >       <title>Xforms</title>
> > > >       <style type="text/css">
> > > >          body {font-family: Helvetica, sans-serif}
> > > >          *:required {background-color: yellow;}
> > > >          *:invalid  { background-color: pink;}
> > > >     </style>
>
> > > >       <model xmlns="http://www.w3.org/2002/xforms"
> > > >          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > >          xmlns:xsi=
> > > >          "http://www.w3.org/2001/XMLSchema-instance">
> > > >          <instance>
> > > >             <trip xmlns="">
> > > >                <start xsi:type="xsd:date">2010-10-10</start>
> > > >                <end xsi:type="xsd:date">2010-10-30</end>
> > > >             </trip></instance>
> > > >          <bind nodeset="/travel">
> > > >             <bind nodeset="return"
> > > >                constraint="days-from-date(end)
> > > >                - days-from-date(start) &gt; 0"/>
> > > >          </bind>
> > > >       </model>
> > > >    </head>
> > > >    <body>
> > > >       <xf:label>Trying to do validation that checks if end date is
> > > > greater than start date.</xf:label><br/><br/>
> > > >       <xf:input ref="start" incremental="true">
> > > >          <xf:label>Starting date</xf:label>
> > > >       </xf:input>
> > > >       <br/><br/>
> > > >       <xf:input ref="end" incremental="true">
> > > >          <xf:label>Ending date</xf:label>
> > > >       </xf:input>
>
> > > >    </body>
> > > >    </html>
>
> > > Hi zuczek!!!
>
> > > Your form have small small mistakes, So, see the modified version of
> > > the code ,
>
> > > <html xmlns="http://www.w3.org/1999/xhtml"
> > >       xmlns:xf="http://www.w3.org/2002/xforms"
> > >       xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > >      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >       xmlns:ev="http://www.w3.org/2001/xml-events">
>
> > >   <head>
> > >       <title>Xforms</title>
> > >               <style type="text/css">
> > >                 body {font-family: Helvetica, sans-serif}
> > >                 *:required {background-color: yellow;}
> > >                 *:invalid  { background-color: pink;}
> > >               </style>
>
> > >       <xf:model>
>
> > >                 <xf:instance>
> > >                     <trip xmlns="">
> > >                       <start xsi:type="xs:date">2010-10-10</start>
> > >                       <end xsi:type="xs:date">2010-10-30</end>
> > >                         <return/>
> > >                     </trip>
> > >                 </xf:instance>
>
> > >                     <xf:bind nodeset="start" type="xs:date"/>
> > >                     <xf:bind nodeset="end" type="xs:date"/>
> > >                     <xf:bind nodeset="return" calculate="if((0 &lt; days-from-
> > > date(end) - days-from-date(start)), 'Valid Date','Date Invalid')"/>
> > >       </xf:model>
> > >   </head>
>
> > >   <body>
> > >       <xf:label>Trying to do validation that checks if end date is
> > > greater than start date.</xf:label><br/><br/>
>
> > >       <xf:input ref="start" incremental="true">
> > >         <xf:label>Starting date</xf:label>
> > >       </xf:input>
> > >       <br/><br/>
>
> > >       <xf:input ref="end" incremental="true">
> > >         <xf:label>Ending date</xf:label>
> > >       </xf:input>
> > >         <!--<xf:action ev:event="xforms-value-changed" if="">
> > >                 <xf:message level="modal">Valid Date</xf:message>
> > >         </xf:action>
> > >         <xf:action ev:event="xforms-value-changed" if="days-from-date(end)-
> > > days-from-date(start) &lt; 0">
> > >                 <xf:message level="modal">InValid Date</xf:message>
> > >         </xf:action>--><br/><br/>
> > >         <xf:output value="if((0 &lt; days-from-date(end) - days-from-
> > > date(start)), 'Valid Date','Date Invalid')"><xf:label>Your Date::</
> > > xf:label></xf:output>
>
> > >   </body>
> > >   </html>
>
> > > By
> > > Rajamani marimuthu and Vivek
> > > OTC
>
> > Thanks a lot for your help! The code worked. Just one more question:
> > if two dates fail to validate is it possible to make my form
> > invalidate (the CSS pink color will be around the invalid control and
> > user won't be able to submit data ) ?
>
> Hi !!!
>
> See the modified code for the valid and invalid representation ..
>
> <html xmlns="http://www.w3.org/1999/xhtml"
>       xmlns:xf="http://www.w3.org/2002/xforms"
>       xmlns:xs="http://www.w3.org/2001/XMLSchema"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xmlns:ev="http://www.w3.org/2001/xml-events">
>
>   <head>
>       <title>Xforms</title>
>               <style type="text/css">
>                 @namespace xhtml url(http://www.w3.org/1999/xhtml);
>
>                 @namespace xf url(http://www.w3.org/2002/xforms);
>
>                 @namespace mozType url(http://www.mozilla.org/projects/xforms/2005/
> type);
>                 body {font-family: Helvetica, sans-serif}
>                 *:required {background-color: yellow;}
>
>                 xf|input:invalid  { background-color: pink;}
>
>               </style>
>
>       <xf:model>
>
>                 <xf:instance id="default">
>                     <trip xmlns="">
>                       <start xsi:type="xs:date"></start>
>                       <end xsi:type="xs:date"></end>
>                         <return/>
>                     </trip>
>                 </xf:instance>
>
>                     <xf:bind id="snode" nodeset="instance('default')/start"
> type="xs:date" required="true()" />
>                     <xf:bind id="enode" nodeset="instance('default')/end"
> type="xs:date" required="true()" calculate="if((days-from-
> date(instance('default')/end) - days-from-date(instance('default')/
> start)) &lt; 0 ,'',instance('default')/end)"/>
>                 <xf:submission id="save" method="put" action="result.xml">
>                                 <xf:message level="modal" ev:event="xforms-submit-done">Submit
> Done</xf:message>
>                                 <xf:message level="modal" ev:event="xforms-submit-error">Submit
> error</xf:message>
>                 </xf:submission>
>       </xf:model>
>   </head>
>
>   <body>
>       <xf:label>Trying to do validation that checks if end date is
> greater than start date.</xf:label><br/><br/>
>
>       <xf:input bind="snode" incremental="true">
>         <xf:label>Starting date</xf:label>
>
>       </xf:input>
>       <br/><br/>
>
>       <xf:input bind="enode" incremental="true">
>         <xf:label>Ending date</xf:label>
>                 <xf:action ev:event="DOMFocusIn" if="days-from-date(end) - days-from-
> date(start) &lt;0">
>                         <xf:setvalue ref="end" value="''"/>
>                 </xf:action>
>       </xf:input>
>         <br/><br/>
>         <xf:output value="if((0 &lt; days-from-date(end) - days-from-
> date(start)), 'Valid Date','Date Invalid')"><xf:label>Your Date::</
> xf:label></xf:output>
> <br/>
> <xf:submit submission="save">
>         <xf:label>Save</xf:label>
> </xf:submit>
>   </body>
>   </html>
>
> By
> Rajamani marimuthu and Vivek
> XRX Team

That's what i was looking for! Now i can analyze it and understand
more xforms :)
Thanks a lot for your help Rajamani.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Loading...