You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by H....@MI.unimaas.nl on 2003/12/31 17:25:56 UTC
Woody form does not validate
Hi,
I've been struggling with this all day, but I can't find what's going on. I
have a basic form with mostly string-based fields, one date field and one
string based field that uses radiobuttons for selection. No repeaters,
nothing special.
I've managed to bind a simple XML document, i.e. the values of the documents
show up in the form. But from then on, nothing happens as it should be. When
I enter an obviously invalid date (34343434) I don't get an "invalid date"
message, the form simply reloads, removing all changes.
I cannot find the cause, because I've built my form after the various
examples in the Woody samples.
Sorry for making it such a huge post.
Thanks and bye, Helma
Here are the files:
Sitemap snippet:
<map:match pattern="addEditPatient">
<map:generate src="scratchpad/addEditPatient.xml" />
<map:transform type="woody" label="debug3" />
<map:transform src="stylesheets/woody-samples-styling.xsl" label="debug4">
<map:parameter name="uri" value="system/scripts"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
<map:match pattern="addEditPatient.exec">
<map:call function="woody">
<map:parameter name="function" value="prot_addEditPatient" />
<map:parameter name="form-definition"
value="scratchpad/addEditPersonDef.xml" />
<map:parameter name="bindingURI"
value="scratchpad/addEditPersonBind.xml" />
<map:parameter name="documentURI" value="scratchpad/person_data.xml" />
</map:call>
</map:match>
/**
* addEdit Patient
*/
Flowscripts.js:
function prot_addEditPatient(form) {
// get the documentURI parameter from the sitemap which contains the
// location of the file to be edited
var documentURI = cocoon.parameters["documentURI"];
// parse the document to a DOM-tree
var document = loadDocument(documentURI);
// bind the document data to the form
form.load(document);
print("before loop in prot_addEditPatient");
print("just inside loop");
// shows the form to the user until is validated successfully
form.showForm("addEditPatient");
var finished = form.isValid;
print("finished=" + finished);
// bind the form's data back to the document
form.save(document);
saveDocument(document, makeTargetURI(documentURI));
cocoon.sendPage("login-success-pipline");
} // addEditPerson
addEditPersonDef.xml
<?xml version="1.0" encoding="UTF-8"?>
<wd:form xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
xmlns:wb="http://apache.org/cocoon/woody/binding/1.0"
wb:context="/PIDS/identity"
>
<wd:widgets>
<wd:field id="lastName" wb:path="name/last">
<wd:label>Achternaam</wd:label>
<wd:datatype base="string">
<wd:validation/>
</wd:datatype>
</wd:field>
<wd:field id="firstName" wb:path="name/first">
<wd:label>Voornaam</wd:label>
<wd:datatype base="string">
<wd:validation/>
</wd:datatype>
</wd:field>
<wd:field id="middleName" wb:path="name/middle">
<wd:label>Tussenvoegsel(s)</wd:label>
<wd:datatype base="string">
<wd:validation/>
</wd:datatype>
</wd:field>
<wd:field id="BirthDate" wb:path="birthday">
<wd:label>Geboortedatum</wd:label>
<wd:hint>voer de datum in als dd-mm-jjjj</wd:hint>
<wd:datatype base="date">
<wd:convertor type="formatting">
<wd:pattern>dd-MM-yyyy</wd:pattern>
</wd:convertor>
</wd:datatype>
</wd:field>
<wd:field id="Sex" wb:path="sex">
<wd:label>Geslacht</wd:label>
<wd:datatype base="string"/>
<wd:selection-list>
<wd:item value="Male">
<wd:label>Man</wd:label>
</wd:item>
<wd:item value="Female">
<wd:label>Vrouw</wd:label>
</wd:item>
<wd:item value="Unknown">
<wd:label>onbekend</wd:label>
</wd:item>
</wd:selection-list>
</wd:field>
<wd:field id="Street" wb:path="address/street">
<wd:label>Straat</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="Postcode" wb:path="address/postcode">
<wd:label>Postcode</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="City" wb:path="address/city">
<wd:label>Stad</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="Country" wb:path="address/country">
<wd:label>Land</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="PhoneCountry" wb:path="phone/country">
<wd:label>Landcode</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="PhoneAreaCode" wb:path="phone/areacode">
<wd:label>Netnummer</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="PhoneNumber" wb:path="phone/number">
<wd:label>Telefoonnummer</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="FaxCountry" wb:path="fax/country">
<wd:label>Landcode</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="FaxAreaCode" wb:path="fax/areacode">
<wd:label>Netnummer</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="FaxNumber" wb:path="fax/number">
<wd:label>Faxnummer</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="Email" wb:path="phone/email">
<wd:label>Emailadres</wd:label>
<wd:datatype base="string">
<wd:validation>
<wd:email/>
</wd:validation>
</wd:datatype>
</wd:field>
<wd:field id="Profession" wb:path="profession">
<wd:label>Beroep</wd:label>
<wd:datatype base="string"/>
<wd:selection-list>
<wd:item value="DEV">
<wd:label>Software ontwikkelaar</wd:label>
</wd:item>
<wd:item value="PT">
<wd:label>Fysiotherapeut</wd:label>
</wd:item>
<wd:item value="ST">
<wd:label>Logopedist</wd:label>
</wd:item>
<wd:item value="ZZC">
<wd:label>Zorgcoordinator AZM</wd:label>
</wd:item>
<wd:item value="TZC">
<wd:label>Thuiszorg coordinator</wd:label>
</wd:item>
<wd:item value="GP">
<wd:label>Huisarts</wd:label>
</wd:item>
<wd:item value="RA">
<wd:label>Revalidatie arts</wd:label>
</wd:item>
<wd:item value="OC">
<wd:label>Ergotherapeut</wd:label>
</wd:item>
<wd:item value="NEU">
<wd:label>Neuroloog</wd:label>
</wd:item>
</wd:selection-list>
</wd:field>
</wd:widgets>
</wd:form>
addEditPersonBind.xml
<?xml version="1.0" encoding="UTF-8"?>
<wb:context xmlns:wb="http://apache.org/cocoon/woody/binding/1.0"
xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
path="/PIDS/identity">
<wb:context path="name">
<wb:value id="lastName" path="last"/>
<wb:value id="firstName" path="first"/>
<wb:value id="middleName" path="middle"/>
</wb:context>
<wb:value id="BirthDate" path="birthday">
<wd:convertor datatype="date" type="formatting">
<wd:patterns>
<wd:pattern>yyyy-MM-dd</wd:pattern>
</wd:patterns>
</wd:convertor>
</wb:value>
<wb:value id="Sex" path="sex"/>
<wb:context path="address">
<wb:value id="Street" path="street"/>
<wb:value id="Postcode" path="postcode"/>
<wb:value id="City" path="city"/>
<wb:value id="Country" path="country"/>
</wb:context>
<wb:context path="phone">
<wb:value id="PhoneCountry" path="country"/>
<wb:value id="PhoneAreaCode" path="areacode"/>
<wb:value id="PhoneNumber" path="number"/>
<wb:value id="Email" path="email"/>
</wb:context>
<wb:context path="fax">
<wb:value id="FaxCountry" path="country"/>
<wb:value id="FaxAreaCode" path="areacode"/>
<wb:value id="FaxNumber" path="number"/>
</wb:context>
<wb:value id="Profession" path="profession"/>
</wb:context>
addEditPatient.xml
<?xml version="1.0" encoding="UTF-8"?>
<layout xmlns:wt="http://apache.org/cocoon/woody/template/1.0"
xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"
xmlns:xsp="http://apache.org/xsp">
<title>Proper Wijzig persoonsgegevens</title>
<header>Persoon wijzigen/toevoegen</header>
<content>
<contentHeader>Patient toevoegen/wijzigen</contentHeader>
<contentText>
Voeg een nieuwe patient toe of wijzig de gegevens van een bestaande
patient.
</contentText>
<wt:form-template action="" method="POST">
<wt:continuation-id/>
<wi:group>
<wi:styling type="fieldset"/>
<wi:label>Naam</wi:label>
<wi:items>
<verticalList>
<col>
<header width="30%">
<wt:widget-label id="firstName"/>
</header>
<header>
<wt:widget-label id="middleName"/>
</header>
<header>
<wt:widget-label id="lastName"/>
</header>
</col>
<data>
<row>
<field width="30%">
<wt:widget id="firstName"/>
</field>
<field>
<wt:widget id="middleName"/>
</field>
<field>
<wt:widget id="lastName"/>
</field>
</row>
</data>
</verticalList>
</wi:items>
</wi:group>
<wi:group>
<wi:styling type="fieldset"/>
<wi:label>Adres</wi:label>
<wi:items>
<verticalList>
<col>
<header width="30%">
<wt:widget-label id="Street"/>
</header>
<header>
<wt:widget-label id="Postcode"/>
</header>
<header>
<wt:widget-label id="City"/>
</header>
<header>
<wt:widget-label id="Country"/>
</header>
</col>
<data>
<row>
<field width="30%">
<wt:widget id="Street"/>
</field>
<field>
<wt:widget id="Postcode"/>
</field>
<field>
<wt:widget id="City"/>
</field>
<field>
<wt:widget id="Country"/>
</field>
</row>
</data>
</verticalList>
</wi:items>
</wi:group>
<wi:group>
<wi:styling type="fieldset"/>
<wi:label>Telefoon</wi:label>
<wi:items>
<verticalList>
<col>
<header width="30%">
<wt:widget-label id="PhoneCountry"/>
</header>
<header>
<wt:widget-label id="PhoneAreaCode"/>
</header>
<header>
<wt:widget-label id="PhoneNumber"/>
</header>
</col>
<data>
<row>
<field width="30%">
<wt:widget id="PhoneCountry"/>
</field>
<field>
<wt:widget id="PhoneAreaCode"/>
</field>
<field>
<wt:widget id="PhoneNumber"/>
</field>
</row>
</data>
</verticalList>
</wi:items>
</wi:group>
<wi:group>
<wi:styling type="fieldset"/>
<wi:label>Overig</wi:label>
<wi:items>
<verticalList>
<col>
<header width="30%">
<wt:widget-label id="BirthDate"/>
</header>
<header>
<wt:widget-label id="Sex"/>
</header>
</col>
<data>
<row>
<field width="30%">
<wt:widget id="BirthDate">
<wt:styling type="date"/>
</wt:widget>
</field>
<field>
<wt:widget id="Sex">
<wi:styling list-type="radio"
list-orientation="horizontal"/>
</wt:widget>
</field>
</row>
</data>
</verticalList>
</wi:items>
</wi:group>
<verticalList>
<col>
<header width="30%"> </header>
</col>
<data>
<row>
<field width="30%">
<input type="submit" id="saveButton" value="Opslaan"/>
</field>
</row>
</data>
</verticalList>
</wt:form-template>
</content>
</layout>
Person_data.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<PIDS>
<identity>
<id>
<id>1</id>
<domain>DNS:proper.mi.unimaas.nl</domain>
</id>
<address>
<street>pobox 1234</street>
<street2 />
<postcode>1234 AB</postcode>
<city>somewhere</city>
<state />
<country>whatever</country>
</address>
<name>
<last>Panzee</last>
<first>Jim</first>
<middle />
</name>
<phone>
<email>jim.panzee@mail.com</email>
<country>1</country>
<areacode>555</areacode>
<number>12345</number>
</phone>
<fax>
<email />
<country>1</country>
<areacode>555</areacode>
<number>65433</number>
</fax>
<profession>DEV</profession>
</identity>
</PIDS>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org