SMS Message

<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:xforms="http://www.w3.org/2002/xforms" 
      xmlns:ev="http://www.w3.org/2001/xml-events" 
      xmlns:my="test">
  <head>
    <link rel="stylesheet" type="text/css" href="xformsdemo.css" />
    <xforms:model id="form1">
      <xforms:submission id="submit1" method2="postxml" 
        localfile="temp2.xml" target2="http://www.hut.fi/"/>
      <xforms:instance id="instance1" xmlns="" >
        <sms>
          <number>555-556</number>
          <text/>
          <length>
            <current>0</current>
            <left></left>
            <maximum>160</maximum>
          </length>
        </sms>
      </xforms:instance>
      <xforms:bind ref="/sms/length/current" 
                   calculate="string-length(/sms/text)"/>
      <xforms:bind ref="/sms/length/left" 
                   calculate="../maximum - ../current" 
                   constraint="/sms/length/left &gt; -1"/>
    </xforms:model>
  </head>
<body>

<p class="headline">SMS Message</p>
<p>This example demonstrates the incremental changes to the instance.
Every character typed into the message will trigger the calculation of
the remaining characters.</p>
<p>
<xforms:input ref="/sms/number">
  <xforms:label>Telephone number</xforms:label>
</xforms:input>
</p>
<p>
<xforms:output ref="/sms/length/left" >
  <xforms:label>Characters left</xforms:label>
</xforms:output>
</p>
<p>
<xforms:textarea ref="/sms/text" incremental="true">
  <xforms:label>Message</xforms:label>
</xforms:textarea>
</p>
<p>
<xforms:trigger>
  <xforms:label>Duplicate</xforms:label>
  <xforms:setvalue ev:event="DOMActivate" ref="/sms/text" value="concat(.,.)"/>
</xforms:trigger>

</p>
<p>
<xforms:submit submission="submit1">
  <xforms:label>Send</xforms:label>
</xforms:submit>
</p>
</body>
</html>


Previous | Next | Top | Cafe con Leche

Copyright 2005 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified March 11, 2005