Hi all,

I'm using CForms and the binding framework to edit an XML document. That's working great. What I'd like to do is validate the document against an XML Schema after it's been updated with the values from the form. How can I achieve this?

The flowscript which controls the form at the moment looks like this (copied heavily from the cocoon samples):

        function enterForecasts(form)
        {
          // parse the document to a DOM-tree
          var documentObj = loadDocument("sampledata.xml");

          // bind the document data to the form
          form.load(documentObj);
          // show the form to the user until it is validated successfully
          form.showForm("form-display-pipeline");
          // bind the form's data back to the document
          form.save(documentObj);

          // save the DOM-tree back to an XML file, the makeTargetURI
          // function makes a modified filename so that the
          // original document is not overwritten
          saveDocument(documentObj, makeTargetURI(documentURI));

          cocoon.sendPage("form-success-pipeline");
        }

What I'd like to be able to do is insert some code after the form.save(...) line which validates the form, and loops back to the form.load(...) line if validation fails. Any suggestions?

Thanks in advance,

Vil.
--
            __
   o|   _. /  \|o._  _  _ ._  _  ._  _ _|_
\/ ||\/(_|| (|/||| |(/_(_)| |(/_o| |(/_ |_
     /     \__
http://website.lineone.net/~vilya


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to