|
Subject: Customizable submit error messages Newsgroups: gmane.comp.apache.mod-survey.general Date: 2008-02-08 14:24:16 GMT (1 year, 21 weeks, 1 day and 57 minutes ago)
For the upcoming -pre release I have added the option to customize error
messages. By using the new SUBMITERROR tag you can display your own html
code if a specific error happens. A short example:
<SURVEY TITLE="test">
<MATRIX NAME="matr" CAPTION="matrix" MUSTANSWER="yes">
<MATRIXCOLUMN VALUE="1" CAPTION="1" />
<MATRIXCOLUMN VALUE="2" CAPTION="2" />
<MATRIXCOLUMN VALUE="3" CAPTION="3" />
<MATRIXROW CAPTION="a" />
<MATRIXROW CAPTION="b" />
<MATRIXROW CAPTION="c" />
</MATRIX>
<SUBMITERROR CODE="2">
<html>
<body bgcolor="#AAAAFF">
<h1 style="color: #FF0000;">Whups!</h1>
You know, there's this matrix (with caption "$caption") that has
a row with the question text "$rowcaption". I'd really like you
to answer that, so please press back in your browser and do so.
</body>
</html>
</SUBMITERROR>
</SURVEY>
The "CODE" parameter is the submit error code. The following errors might
be interesting to override with a SUBMITERROR:
2: The question must be answered
7: Answer must be numerical
8: Cannot be higher than
9: Cannot be lower than
10: Not valid (happens when answers must be unique on both col and row in
a matrix)
You can write messages for the other codes too, but those are more system
errors (such as "cannot connect to database" and similar).
The html body may contain a number of variables which will be parsed.
These are:
$caption: the CAPTION parameter of the tag
$rowcaption: the CAPTION parameter of the MATRIXROW (if applicable)
$tagnumber: the number of the tag in the page
$name: the variable name
$shortdesc: the error message that would be displayed if you didn't write
your own SUBMITERROR.
This code is in SVN if you are eager to test. Otherwise a -pre release
should be available soon.
// Joel
Skickat av Joel Palmius <joel.palmius <at> miun.se>
till survey-discussion
|
|
|