You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2004/12/03 18:27:13 UTC

DO NOT REPLY [Bug 32419] - [patch] client side validation for CForms

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32419>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32419





------- Additional Comments From l.garulli@gmail.com  2004-12-03 18:27 -------
(From update of attachment 13566)
<?xml version="1.0"?>
<!--
  clientside-validation
  @author Luca Garulli (l.garulli@pro-netics.com)
  -->
  <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
  <xsl:param name="mode">form</xsl:param>

  <xsl:template match="page">
    <page>
      <xsl:apply-templates select="head"/>
      <xsl:apply-templates select="body"/>
    </page>
  </xsl:template>

  <xsl:template match="head">
    <head>
      <script language="javascript" src="/js/date.js"/>
      <script language="javascript" src="/js/clientside-validation.js"/>
      <script language="javascript">
	<!-- REGISTER ALL WIDGETS -->
	function validation_init()
	{
	<xsl:for-each select="..//fi:field">
	  validation_register_widget( '<xsl:value-of select="@id"/>',
				      <xsl:if
test="@required='true'">true</xsl:if>,
				      '<xsl:value-of
select="fi:datatype/@type"/>',
				      '<xsl:value-of
select="fi:datatype/fi:convertor/@pattern"/>' );
	</xsl:for-each>
	}
	validation_init();
      </script>
      <xsl:apply-templates/>
    </head>
  </xsl:template>

  <xsl:template match="body">
      <xsl:copy-of select="."/>
  </xsl:template>

  <!--xsl:template match="fi:field">
    <xsl:if test="$mode='field'">
      <fi:field>
	<fi:styling onChange="javascript:validate_<xsl:value-of
select="@id"/>();"/>
      </fi:field>
    </xsl:if>
  </xsl:template-->

</xsl:stylesheet>


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.