Hi Jeremiah,
Thanks, that is a bit more clear now.
XForms provides for adding and deleting nodes where a template for the node exists, but in your
case it is all specified at runtime by the user, so I don't immediately see how you can build such
a nodeset at runtime using xforms:insert .
What if the nodeset you were binding to were replaced? Then perhaps the binding part would
re-run. You could submit to an xpl/xslt service the values for the types the user has selected,
and it would return the nodeset rewritten with the new types.
I can only assume that the same steps as the model construct occur when an instance is
replaced, including re-evaluating the bindings.
Of course, there is a question about how to do the submit. I suppose you don't want to require
the user to click a trigger such as "Refresh" or "Confirm changes", but that would make the
test quicker to write.
HTH,
Hank
On Feb 8, 2010, at 1:45 PM, Jeremiah Jahn wrote:
guess I'm not quite sure how that would help, having never used it for anything before.
I'll flush out my example a little bit more:
<xforms:bind nodeset="for $currentItem in instance('data')/descendant-or-self::*/@* return $currentItem[$currentItem/name() = instance('types')/types/type[@typeID = $currentItem/../name()]/type[binding/@type = 'xs:string']/@typeID]" type="xs:string" />
<xforms:bind nodeset="for $currentItem in instance('data')/descendant-or-self::*/@* return $currentItem[$currentItem/name() = instance('types')/types/type[@typeID = $currentItem/../name()]/type[binding/@type = 'xs:date']/@typeID]" type="xs:date" />
<xforms:bind nodeset="for $currentItem in instance('data')/descendant-or-self::*/@* return $currentItem[$currentItem/name() = instance('types')/types/type[@typeID = $currentItem/../name()]/type[binding/@type = 'xs:int']/@typeID]" type="xs:int" />
<xforms:bind nodeset="for $currentItem in instance('data')/descendant-or-self::*/@* return $currentItem[$currentItem/name() = instance('types')/types/type[@typeID = $currentItem/../name()]/type[binding/@type = 'xs:boolean']/@typeID]" type="xs:boolean" />
There is a select1 which sets my type/binding/@type to 'xs:whatever' string, date, boolean etc. The problem is that after choosing a different type for an input, the input is still set to the original value. For example if it was a boolean, and i choose a :xs:string instead, the input stays as a date input and not a text input, or int or whatever I choose. Its as if the above, and there are many more, bind statements are not being reevaluated when the nodeset changes. i was hoping there was an event I could dispatch that would cause it to re-whatever. The calculate attribute doesn't seem to be what I need, as I'm not changing the value, but the type.
On Feb 8, 2010, at 9:41 AM, Hank Ratzesberger wrote:
Jeremiah,
Have you tried the calculate= attribute? That is executed when dependent nodesets change.
--Hank
On Feb 7, 2010, at 6:48 PM, Jeremiah Jahn wrote:
I tried this, and although it works for the initial view of the page, I'm obviously missing something to get it to recalculate or something after I change the type. Do I need to dispatch something? because the xpath is defiantly working. Like I said, it just seems to only work on the initial load, but not after any changes.
<xforms:bind nodeset="for $currentItem in instance('data')/descendant-or-self::*/@* return $currentItem[$currentItem/name() = instance('types')/types/type[@typeID = $currentItem/../name()]/type[binding/@type = 'xs:boolean']/@typeID]" type="xs:boolean" />
On Jan 27, 2010, at 10:40 AM, Erik Bruchez wrote:
Jeremiah,
It's not possible to add a new xforms:bind, but if you already had
binds with all the types in your form, you could play with the
@nodeset attribute, e.g.:
<xforms:bind type="xs:integer" nodeset="...dynamically point to nodes
that must be integers..."/>
-Erik
On Sat, Jan 2, 2010 at 11:21 AM, Jeremiah Jahn <
[hidden email]> wrote:
Is it possible to dynamically add a bind element to the model?
I have a form where users can add another field to it, and I want them to be able to specify the xs:type of the field. I know I can submit the form, and then reload it with the additonal bind element added to the model, but I was really hoping that I wouldn't have to make that round trip call. and That I could use some sort of xforms:insert or something. This seems like something that has to have been tackled in formbuilder, so I figure there must be a way.
thanks for the help.
--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe:
[hidden email]For general help: mailto:
[hidden email]?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws
--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042
--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042