Login   Register  
PHP Classes
elePHPant
Icontem

File: exprForm/index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of yo keller  >  metaForm  >  exprForm/index.php  >  Download  
File: exprForm/index.php
Role: Example script
Content type: text/plain
Description: form generator invocation script
Class: metaForm
Generate and validate forms from XML definitions
Author: By
Last change:
Date: 9 years ago
Size: 1,691 bytes
 

Contents

Class file image Download
<!--
    Version: 1.0
    Copyright (C) 2002 Herman Veluwenkamp
    Version: 2.0
    Copyright (C) 2005 Yo Keller
-->
<html>
<head><title>form expressions test</title>
<!--
<style>
body,td,select,textarea,input,pre
              { font: 9pt "arial", "helvetica", sans-serif; }
</style>
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
-->
<link rel="stylesheet" type="text/css" href="search-form.css" media="all" />
<script language="javascript" src="formValidated.js"></script>
</head>
<body>

<?php
print "<h2>configuration Test</h2>";

include 
'../xmlForm.php';
$verb 1;    // verbose flag
$xslForm   join(''file('expr_Conf.xsl'));
$xmlConfig join(''file('expr_Conf.xml'));
$xmlForm  = new xmlForm($xmlConfig);
//print "validationError: ".$xmlForm->validationError."<hr />\n";

if ($xmlForm->validationError)
    print 
"<h2>WARNING: configuration error!!</h2>\n".$xmlForm->newConf."<hr />\n";
else {
    print 
"<h2>configuration OK</h2>";
    if (
$verb) print $xmlForm->newConf;
    print 
"<hr />\n";
}

// do server-side validation
$data $_REQUEST;    //$HTTP_GET_VARS;
if ($verb){
    print 
"<h2>original data</h2>\n";
    
print_r($data);
    print 
"<hr />";
}
if (!empty(
$data)) {
  
$result     $xmlForm->validate($data);
  
//if (!$result) print "<h2>Validation Error</h2>\n".$xmlForm->conf."<hr />\n".$xmlForm->newConf."<hr />\n";
  
if (!$result) print "<h2>Validation Error</h2>\n".$xmlForm->newConf."<hr />\n";
  else print 
"<h2>data OK</h2>";
}

// prepare html form for display
$result $xmlForm->xslTransform($xslForm, array());
if (
$result) print $xmlForm->output;
else print 
$xmlForm->error;

?>
</body>
</html>