cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kai.Reh...@pass-consulting.com
Subject include javascript
Date Tue, 28 Nov 2000 11:03:59 GMT
Hi all,
can someone please help me on including a javascript file into an xml file?
The script is running fine if included into an html file but trying to
include it into the xml file a javascript error occurs.

**************
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>


<xsl:template match="Upload">
<xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>

<html>
<head>
<script language="JavaScript" type="text/javascript"  src="./script.js"/>

	<title>
		Dokumenten Auswahl
	</title>
</head>

<body bgcolor="orange">

<FORM ACTION="http://localhost:8080/fue/servlet/upload" METHOD="POST"
ENCTYPE="multipart/form-data" onsubmit="return verify(this);">

<!-- and so on -->

<xsl:apply-templates/>

</FORM>
</body>
</html>
************************script.js***************************
<script language="JavaScript" type="text/javascript">

function isblank(s) {
for (var i= 0; i < s.length; i++) {
var c = s.charAt(i);
if ((c!= ' ') && (c!= '\n') && (c!= '\t')) return false;
}
return true;
}

function verify(f) {
var msg;
var empty_fields = "";

for (var i = 0; i < f.length; i++) {
var e = f.elements[i];
if (((e.type == "text") || (e.type == "textarea")) && !e.optional) {
if ((e.value == null) || (e.value == "") || isblank(e.value)) {
empty_fields += "\n		" +e.name;
continue;
}
// check for numeric goes here
}
}
// Return errors
if (!empty_fields) return true;

msg  = "______________________________________\n\n"
msg += "Das Formular ist nicht vollständig ausgefüllt. \n";
msg += "Bitte korrigiere den,die Fehler. \n";
msg += "______________________________________\n\n"

if (empty_fields) {
msg += "-Folgende Felder sind leer: "
	+ empty_fields + "\n";
}
alert(msg);
return false;
}
</script>

Mime
View raw message