You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2004/01/16 16:03:24 UTC
cvs commit: cocoon-lenya/src/webapp/lenya/xslt/authoring create.xsl
gregor 2004/01/16 07:03:24
Modified: src/webapp/lenya/xslt/authoring create.xsl
Log:
validate required fields
Revision Changes Path
1.2 +30 -4 cocoon-lenya/src/webapp/lenya/xslt/authoring/create.xsl
Index: create.xsl
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/xslt/authoring/create.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- create.xsl 3 Jul 2003 14:44:59 -0000 1.1
+++ create.xsl 16 Jan 2004 15:03:24 -0000 1.2
@@ -25,8 +25,34 @@
<div class="lenya-box">
<div class="lenya-box-title">New Document</div>
<div class="lenya-box-body">
- <form method="GET"
- action="{/parent-child/referer}">
+ <script Language="JavaScript">
+function validRequired(formField,fieldLabel)
+{
+ var result = true;
+
+ if (formField.value == "")
+ {
+ alert('Please enter a value for the "' + fieldLabel +'" field.');
+ formField.focus();
+ result = false;
+ }
+
+ return result;
+}
+
+function validateForm(theForm)
+{
+ if (!validRequired(theForm["properties.create.child-id"],"Document ID"))
+ return false;
+
+ if (!validRequired(theForm["properties.create.child-name"],"Navigation Title"))
+ return false;
+
+ return true;
+}
+</script>
+ <form method="GET"
+ action="{/parent-child/referer}" onsubmit="return validateForm(this)">
<input type="hidden" name="properties.create.parent-id" value="{/parent-child/parentid}"/>
<input type="hidden" name="lenya.usecase" value="{$lenya.usecase}"/>
<input type="hidden" name="lenya.step" value="create"/>
@@ -34,10 +60,10 @@
<input type="hidden" name="properties.create.doctype" value="{/parent-child/doctype}"/>
<table class="lenya-table-noborder">
<tr>
- <td class="lenya-form-caption">Parent ID:</td><td>hidden value="<xsl:value-of select="/parent-child/parentid"/>"</td>
+ <td class="lenya-form-caption">Parent ID:</td><td><xsl:value-of select="/parent-child/parentid"/></td>
</tr>
<tr>
- <td class="lenya-form-caption">ID:</td><td><input class="lenya-form-element" type="text" name="properties.create.child-id"/></td>
+ <td class="lenya-form-caption">Document ID:</td><td><input class="lenya-form-element" type="text" name="properties.create.child-id"/></td>
</tr>
<tr>
<td class="lenya-form-caption">Name:</td><td><input class="lenya-form-element" type="text" name="properties.create.child-name"/></td>
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org