PHP Classes

File: formClientValidatedJsArray.xsl

Recommend this page to a friend!
  Classes of Herman Veluwenkamp   xmlForm   formClientValidatedJsArray.xsl   Download  
File: formClientValidatedJsArray.xsl
Role: ???
Content type: text/plain
Description: XSL Stylesheet to Generate Javascript Array for Client Validation Example
Class: xmlForm
Generates a form in HTML.
Author: By
Last change:
Date: 20 years ago
Size: 1,060 bytes


Class file image Download
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl=""> <xsl:output method = "text"/> <xsl:template match="form-config"> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <xsl:for-each select="var"> field[<xsl:number format="1"/>] = Array( '<xsl:value-of select="@name"/>', <!-- name of data field --> '<xsl:value-of select="@type"/>', <!-- type of field being displayed --> '<xsl:value-of select="description"/>', <!-- description of field --> <xsl:value-of select="validation-regexp"/>, <!-- data validation regular expression --> '<xsl:value-of select="validation-message"/>',<!-- message to display when data is invalid --> <xsl:choose> <xsl:when test='@type="text"'>'1'</xsl:when> <xsl:when test='@type="textarea"'>'1'</xsl:when> <xsl:otherwise>'<xsl:value-of select = "count(option)" />'</xsl:otherwise> </xsl:choose> ); </xsl:for-each> </SCRIPT> </xsl:template> </xsl:stylesheet>