Source Code

for file S02_AJAXCoreSamples/ajaxFormsTest.htm

<!DOCTYPE html>
<html lang="en">
<head runat="server">
  <title>Client Form Page Test</title>
  <link href="/mathertel.css" rel="stylesheet" type="text/css" />

  <script type="text/javascript" src="/ajaxcore/ajax.js"></script>
  <script type="text/javascript" src="/ajaxcore/ajaxForms.js"></script>
</head>

<body>
  <h1>Client Form Page Test</h1>
  <div id="frm" style="margin: 2px; padding: 2px; border: solid 1px green">
    <p>F1:
      <input name="F1" value="one by one"></p>
    <p>F2:
      <input type="checkbox" name="F2"></p>
    <p>T1:
      <textarea name="T1" style="width: 400px; height: 80px">some
text
lines</textarea>
      <p>S1:
        <select name="S1">
          <option value="10">ten</option>
          <option value="11">eleven</option>
          <option value="12" selected="selected">twelve</option>
          <option value="13">thirteen</option>
        </select>
  </div>
  <p>XML (Text):</p>
  <p>
    <textarea id="xmlText" style="width: 95%; height: 155px">
<data>
  <F1>F1</F1>
  <F2>F2</F2>
  <T1>T1</T1>
  <S1>10</S1>
</data>
</textarea></p>
  <p>
    <input type="button" onclick="testGet()" value="GetDATA">
    &nbsp;
    <input type="button" onclick="testSet()" value="SetDATA">
    &nbsp;
    <input type="button" onclick="ajaxForms.clearData('frm')" value="clearData">
    &nbsp;
    <input type="button" onclick="ajaxForms.resetData('frm')" value="resetData">
    <script>
function testGet() {
  var xData = ajaxForms.getData('frm');
  if (typeof(XMLSerializer) != "undefined")
    document.getElementById("xmlText").value = (new XMLSerializer()).serializeToString(xData);
  else
    document.getElementById("xmlText").value = xData.xml;
}

function testSet() {
  ajaxForms.setData(document.getElementById("xmlText").value, 'frm'); 
}

    </script>
</body>

</html>


This page is part of the http://www.mathertel.de/ web site.

For updates and discussions see http://ajaxaspects.blogspot.com/.