I have a form that, when it is submitted, I use a custom processor to write the form out to a special folder.
I use a trigger to activate this custom processor (example code below). The problem I am running into is that no field validation occurs. My users can just press the button and away the form goes. I wanted to find out if there is some kind of validation call I can make so that I don't attempt to save the form until all my enforced fields are filled in correctly. Can anyone shed some light on this? I am using ops 3 beta4. Example code: <!-- button use clicks to activate save --> <xhtml:p> <xforms:trigger> <xforms:label>Save data</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:send submission="save-form"/> <xforms: toggle case="saved"/> </xforms:action> </xforms:trigger> </xforms:p> <!-- Custom processor reference --> <xforms:submission id="save-form" method="post" action="/services/save-form" replace="instance"/> Thanks. - Dan -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
I posted the same question a while ago. There is an example (bizdoc I
think) that shows how to augument your page-flow.xml to make sure all fields are populated with valid data before submitting. The logic is based on checking values of the xxforms:valid and xxforms:relevant attributes. Something along these lines: <action when="(<your submission params> and /your/form-model//*[@xxforms:valid = 'false' and not(ancestor-or-self::*[@xxforms:relevant = 'false'])]"> A. On Dec 13, 2005, at 5:20 PM, [hidden email] wrote: > I have a form that, when it is submitted, I use a custom processor to > write the form out to a special folder. > > I use a trigger to activate this custom processor (example code below). > > The problem I am running into is that no field validation occurs. My > users can just press the button and away the form goes. I wanted to > find out if there is some kind of validation call I can make so that I > don't attempt to save the form until all my enforced fields are filled > in correctly. > > Can anyone shed some light on this? I am using ops 3 beta4. > > Example code: > > <!-- button use clicks to activate save --> > <xhtml:p> > <xforms:trigger> > <xforms:label>Save data</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:send submission="save-form"/> > <xforms: toggle case="saved"/> > </xforms:action> > </xforms:trigger> > </xforms:p> > > <!-- Custom processor reference --> > <xforms:submission id="save-form" method="post" > action="/services/save-form" replace="instance"/> > > Thanks. > > - Dan > > > -- > You receive this message as a subscriber of the > [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by danc-3
Dan,
If your XForms instance is not valid (and also if some fields are required but empty), it won't be sumitted, period! So there is nothing particular to do provided you either use an XML schema or xforms:bind elements to validate your instance in your XForms model. This is quite well illustrated by the BizDoc NG example. -Erik [hidden email] wrote: > I have a form that, when it is submitted, I use a custom processor to write the form out to a special folder. > > I use a trigger to activate this custom processor (example code below). > > The problem I am running into is that no field validation occurs. My users can just press the button and away the form goes. I wanted to find out if there is some kind of validation call I can make so that I don't attempt to save the form until all my enforced fields are filled in correctly. > > Can anyone shed some light on this? I am using ops 3 beta4. > > > Example code: > > <!-- button use clicks to activate save --> > <xhtml:p> > <xforms:trigger> > <xforms:label>Save data</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:send submission="save-form"/> > <xforms: toggle case="saved"/> > </xforms:action> > </xforms:trigger> > </xforms:p> > > <!-- Custom processor reference --> > <xforms:submission id="save-form" method="post" action="/services/save-form" replace="instance"/> > > > Thanks. > > - Dan -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by Alexander Žaťko
Alex,
Dan's questions is a little different because, based on your example below, you appear to be using the Classic XForms engine, which left to user code in the page flow the decision to handle validity. With XForms NG, as per the XForms spec, an invalid instance will simply not be submitted at all by the XForms engine. -Erik Alexander Zatko wrote: > I posted the same question a while ago. There is an example (bizdoc I > think) that shows how to augument your page-flow.xml to make sure all > fields are populated with valid data before submitting. The logic is > based on checking values of the xxforms:valid and xxforms:relevant > attributes. Something along these lines: > > <action when="(<your submission params> and > /your/form-model//*[@xxforms:valid = 'false' and > not(ancestor-or-self::*[@xxforms:relevant = 'false'])]"> > > A. > > On Dec 13, 2005, at 5:20 PM, [hidden email] wrote: > >> I have a form that, when it is submitted, I use a custom processor to >> write the form out to a special folder. >> >> I use a trigger to activate this custom processor (example code below). >> >> The problem I am running into is that no field validation occurs. My >> users can just press the button and away the form goes. I wanted to >> find out if there is some kind of validation call I can make so that I >> don't attempt to save the form until all my enforced fields are filled >> in correctly. >> >> Can anyone shed some light on this? I am using ops 3 beta4. >> >> Example code: >> >> <!-- button use clicks to activate save --> >> <xhtml:p> >> <xforms:trigger> >> <xforms:label>Save data</xforms:label> >> <xforms:action ev:event="DOMActivate"> >> <xforms:send submission="save-form"/> >> <xforms: toggle case="saved"/> >> </xforms:action> >> </xforms:trigger> >> </xforms:p> >> >> <!-- Custom processor reference --> >> <xforms:submission id="save-form" method="post" >> action="/services/save-form" replace="instance"/> >> >> Thanks. >> >> - Dan >> >> >> -- >> You receive this message as a subscriber of the >> [hidden email] mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > ------------------------------------------------------------------------ > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |