Almost there now get error: --- Tried to set value of output widget "data.dateTime" with an object of an incorrect type: expected class java.util.Date, received class java.lang.String. ---
...but datatype base="date": <fd:output id="dateTime" required="true"> <fd:label>DateTime:</fd:label> <fd:datatype base="date"/> </fd:output> Any clues? Linc -----Original Message----- From: Joerg Heinicke [mailto:[EMAIL PROTECTED] Sent: Sunday, 16 January 2005 7:15 AM To: [email protected] Subject: Re: Adding date and time to a xml file On 15.01.2005 23:27, Lincoln Mitchell wrote: > I will need a bit more guidance on how to set the value of the field to "new > Packages.java.util.Date()". As there appears to be a few locations that > relate to saving the form and I have only little Java experience. My binding > file is: That's not the binding file, but just flowscript. It's the okay for the proof of principle. > --- > cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js"); > function form2xml(form) { > var documentURI = cocoon.parameters["documentURI"]; > var document = loadDocument(documentURI); > form.load(document); > form.showForm("form-display-pipeline"); > form. Here, immediately before saving, set the value of your date widget to the current date: form.getWidget("myDate").value = new Packages.java.util.Date(); > form.save(document); This form.save(document) initializes the binding. Therefore you have to tell in the binding file how to bind the date widget to your <dateTime> element. > saveDocument(document, documentURI); > cocoon.sendPage("form-success-pipeline"); > } The rest (loadDocument and saveDocument) is just for reading and storing the XML. Joerg --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
