Hi! I'm completely stumped on how to get this working. I'm using Orbeon 4.3, coding to plain xforms.
I have a form which I want to use a schema to validate. I would prefer not to use xforms types only, the schema is important documentation and I want to use the same schema to validate the xml elsewhere in its processing. I want to be able to have empty values for types of "xs:date". In the schema, for these date fields I set the type="xs:date" and "nillable=true", the use "xsi:nil="true/false" in the instance. This validates OK outside the xform. Also - I'm not sure this is relevant - I'd like to use the "fr:date" control instead of "xforms:input" + bind type="xs:date" - mainly because I can set mindate and maxdate . Also, I noticed that the "fr:date" control remains a date control even when you clear the input - instead of reverting to a plain text-input. I have tried using both, in each case I've put a single "<xf:alert>" element for a non-valid date. (I had previously used the "multiple alerts/validations" in a bind to these fields, but if I remove these these I still have the problem. I have also styled ".xforms-invalid input" to be a pink background color, presumably this tells me whether the xforms engine marked a field invalid. Also, I found the trick in this thread: http://discuss.orbeon.com/The-state-of-Orbeon-Forms-Part-9-td3014777.html#a3063318 to correctly set the "xsi:nil" value when the field is updated (it seems to work). The problem: If I use an xml instance that has an empty date field but "xsi:nil=true" (which is valid outside the form), and a field bind using xforms type "xs:date", the xforms engine is still marking this as invalid. However, if I remove the "xs:date" type from the bind, and I clear the field, it validates OK, but it reverts to a plain text field. This is not just undesirable appearance-wise, it also means that the only way to get the datepicker back is to enter a valid date such as "2000-01-01": not something I want the user to have to do. So, I am stuck with having "xsi:nil" values being invalid if I use the xforms xs:date type, or having the dateInput -with- datepicker revert to a plain text field. With xform type xs:date, should the xforms engine be marking the date field as invalid if "xsi:nil=true"? Without xform type xs:date, is there a way to keep the date input from reverting back to a plain text field if the textbox is cleared? These date fields are a core aspect of the application I'd like to build, any help is appreciated!
-- Francis
|
Hi,
Were you able to get this around? I am having a similar problem and cannot figure out how to get past this issue as my forms fail to submit with Date fields with no content on the XML payload. Thanks ! Eduardo. |
Administrator
|
Hi Eduardo,
Are you talking about having no element at all (vs. an empty element)? If that is the case, this isn't possible with XForms. If the binding expression for control returns an empty sequence, then the control is considered to be non-relevant, and it won't show. So if you really need not to have the elements at all, vs. having empty elements, you need to do this with a transformation on the XML produced by XForms. And of course, if you have data in that format and need to feed it to the XForms engine, then you also need the opposite transformation. Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |