Hi -
I have a HiddenSelectQuestion component that contains a set of hidden
elements. I want a javascript function that sets the value of the named
element. I have debugged this as straight HTML to make sure the Javascript is
valid. However, Tapestry gives a parse error.
The script is at the bottom of the email. The Tapestry parser does not seem
to like the '<' in the while statement and gives the following exception...
net.sf.tapestry.ApplicationRuntimeException
Unable to parse script
/com/informative/study/jwc/HiddenSelectQuestion.script.
net.sf.tapestry.util.xml.DocumentParseException
Unable to parse /com/informative/study/jwc/HiddenSelectQuestion.script:
The content of elements must consist of well-formed character data
or markup.
column: 19
lineNumber: 34
resourcePath: /com/informative/study/jwc/HiddenSelectQuestion.script
org.xml.sax.SAXParseException
The content of elements must consist of well-formed character data
or markup.
columnNumber: 19
lineNumber: 34
Stack Trace:
org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:235)
org.apache.xerces.jaxp.DocumentBuilderImpl.parse
(DocumentBuilderImpl.java:201)
net.sf.tapestry.util.xml.AbstractDocumentParser.parse
(AbstractDocumentParser.java:199)
net.sf.tapestry.script.ScriptParser.parse(ScriptParser.java:132)
net.sf.tapestry.engine.DefaultScriptSource.parse
(DefaultScriptSource.java:110)
net.sf.tapestry.engine.DefaultScriptSource.getScript
(DefaultScriptSource.java:82)
com.informative.study.jwc.HiddenSelectQuestion.getParsedScript
(HiddenSelectQuestion.java:213)
com.informative.study.jwc.HiddenSelectQuestion.writeScript
(HiddenSelectQuestion.java:203)
com.informative.study.jwc.HiddenSelectQuestion.renderComponent
(HiddenSelectQuestion.java:164)
net.sf.tapestry.AbstractComponent.render(AbstractComponent.java:901)
I am using Tapestry 2.2 in JBoss 3.2 Beta 2. Any pointers or suggestions
would be greatly appreciated! Thanks...
Dorothy
-------------------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE script PUBLIC
"-//Howard Lewis Ship//Tapestry Script 1.2//EN"
"http://tapestry.sf.net/dtd/Script_1_2.dtd">
<script>
<!--
input symbols:
name - report name for question
optionMap - initialization statement for option name:value
form - name of form
output symbols:
none
-->
<input-symbol key="name" class="java.lang.String" required="yes"/>
<input-symbol key="optionMap" class="java.lang.String" required="yes"/>
<input-symbol key="form" class="java.lang.String" required="yes"/>
<body>
function ${name}_select(optionname)
{
var index = 0;
var name = '${name}_' + optionname;
var optionmap = ${optionMap};
while (index < document.${form}.elements.length) {
if (document.${form}.elements[index].type == "hidden") {
alert('Trying: ' + document.${form}.elements[index].name);
if (document.${form}.elements[index].name == name) {
alert('Found: ' + document.${form}.elements[index].name);
document.${form}.elements[index].value = optionname;
return;
}
}
++index;
}
}
</body>
</script>
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer