Generate fullquery represenation
[cql-js-moved-to-github.git] / index.html
index a456092..1024e5b 100644 (file)
@@ -4,12 +4,15 @@
     <script type="text/javascript">
         var cp = new CQLParser();
         
-        function parseOnSubmit(form) {
+        function parseInput(query) {
             try {
-                cp.parse(form.q.value);
+                cp.parse(query);
                 document.getElementById("output").value = cp.toXCQL();
+                document.getElementById("output2").value = cp.toFQ();
             } catch (e) {
                 document.getElementById("output").value = e.message;
+                document.getElementById("output2").value = e.message;
+                throw e;
             }
         }
     </script>
   </head>
   <body>
     <div>
-      <form name="test" onsubmit="parseOnSubmit(this); return false;">
+      <form name="test" onsubmit="parseInput(this.q.value); return false;">
         Query: 
-        <input type="text" name="q" size="160"></input>
+        <input type="text" name="q" size="160" onkeyup="parseInput(this.value); return false;"></input>
         <br>
         <br>
         XCQL:
         <br>
       </form>
       <textarea id="output" rows="80" cols="80"></textarea>
+      <textarea id="output2" rows="80" cols="80"></textarea>
     </div>
   </body>
 </html>