I am in a situation where I have an XML document that has a set of 'optional/mandatory' fields, so I can pass in a very simple document and this will validate.
The document can then have extra XML elements added to it to expand the functionality of the document, these elements cannot be empty, therefore when the are added as empty they become invalid. Example: Load the xForm with simple instance XML: User now wants to add notification emails, so adds the NotifyEmail element with a add button: The above is invalid is the notfiyemail is blank, but that is ok as the user can now edit this field. I can use a insert to insert into the UserInformation block, however how can I add it after the SenderEmail element? Present insert:
|
I would do the following on insert <xforms:insert ev:event="DOMActivate" context="instance('instance_model_Manifest')/UserInformation" position="after" nodeset="SenderEmail" at="last()" origin="instance('NotifyEmail')"/>HTH Ryan Ryan Puddephatt "Measuring programming progress by lines of code is like
measuring aircraft building progress by weight." - Bill Gates ChrisSpeare wrote: I am in a situation where I have an XML document that has a set of 'optional/mandatory' fields, so I can pass in a very simple document and this will validate. The document can then have extra XML elements added to it to expand the functionality of the document, these elements cannot be empty, therefore when the are added as empty they become invalid. Example: Load the xForm with simple instance XML: <UserInformation><AccountID>LKM001</AccountID> <UserID>LKMUSER</UserID> <SenderName>LKM</SenderName> <SenderEmail>[hidden email]</SenderEmail> </UserInformation>User now wants to add notification emails, so adds the NotifyEmail element with a add button:<UserInformation> <AccountID>LKM001</AccountID> <UserID>LKMUSER</UserID> <SenderName>LKM</SenderName> <SenderEmail>[hidden email]</SenderEmail> <NotifyEmail/> </UserInformation>The above is invalid is the notfiyemail is blank, but that is ok as the user can now edit this field. I can use a insert to insert into the UserInformation block, however how can I add it after the SenderEmail element? Present insert:<xforms:insert ev:event="DOMActivate" context="instance('instance_model_Manifest')/UserInformation" position="after" nodeset="NotfiyEmail" origin="instance('NotifyEmail')"/> -- 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 |
Excellant! Thanks Ryan, had been mulling how that was going to happen.
Next question. The notifyemail can have more than one occurance (0 - 2 to be exact), as such needs to feature in a repeat, is it possible to make the repeat reference this element. Thanks again
|
Chris, Excellant! Thanks Ryan, had been mulling how that was going to happen. Next question. The notifyemail can have more than one occurance (0 - 2 to be exact), as such needs to feature in a repeat, is it possible to make the repeat reference this element. What element? the current repeat context? Ryan Thanks again Ryan Puddephatt wrote:Chris, I would do the following on insert <xforms:insert ev:event="DOMActivate" context="instance('instance_model_Manifest')/UserInformation" position="after" nodeset="SenderEmail" at="last()" origin="instance('NotifyEmail')"/> HTH Ryan Ryan Puddephatt Software Engineer Teleflex Group - IT UK 1 Michaelson Square Livingston West Lothian Scotland EH54 7DP e> [hidden email] [hidden email] t> +44(0)1506 407 110 f> +44(0)1506 407 108 w> www.teleflex.com <http://www.teleflex.com> "Measuring programming progress by lines of code is like measuring aircraft building progress by weight." - /Bill Gates/ "If you lie to the compiler, it will get its revenge." - /Henry Spencer/ "It's hard enough to find an error in your code when you're looking for it; it's even harder when you've assumed your code is error-free." - /Steve McConnell/ "If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization." - /Gerald Weinberg/ ChrisSpeare wrote:I am in a situation where I have an XML document that has a set of 'optional/mandatory' fields, so I can pass in a very simple document and this will validate. The document can then have extra XML elements added to it to expand the functionality of the document, these elements cannot be empty, therefore when the are added as empty they become invalid. Example: Load the xForm with simple instance XML: <UserInformation><AccountID>LKM001</AccountID> <UserID>LKMUSER</UserID> <SenderName>LKM</SenderName> <SenderEmail>[hidden email]</SenderEmail> </UserInformation>User now wants to add notification emails, so adds the NotifyEmail element with a add button:<UserInformation> <AccountID>LKM001</AccountID> <UserID>LKMUSER</UserID> <SenderName>LKM</SenderName> <SenderEmail>[hidden email]</SenderEmail> <NotifyEmail/> </UserInformation>The above is invalid is the notfiyemail is blank, but that is ok as the user can now edit this field. I can use a insert to insert into the UserInformation block, however how can I add it after the SenderEmail element? Present insert:<xforms:insert ev:event="DOMActivate" context="instance('instance_model_Manifest')/UserInformation" position="after" nodeset="NotfiyEmail" origin="instance('NotifyEmail')"/> ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] 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: [hidden email] For general help: [hidden email] 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 |
Ryan,
Thanks for the response but after scratching my head head for a second I realised I could make the button do the job by switching the nodeset based on the count of the number of elements. So sorted Thanks for you help, was a real worrier that one.
|
Free forum by Nabble | Edit this page |