Friday 15 April 2011

Orbeon Form Builder - Delete element on submit (xforms-submit) -


I am using the Orbeon Form Builder to create a form. When the form is saved, then I want to remove an element (the last one) from the model.

I have tried to create a workaround basis for examples but it can not be found to work

Given the example

 < Code> & lt; Xf: instance id = "fr-form example" & gt; & Lt; Guide & gt; & Lt; Title / & gt; & Lt; Media & gt; & Lt; Format & gt; Image & lt; / Format & gt; & Lt; / Media & gt; & Lt; Media & gt; & Lt; Format & gt; Video & lt; / Format & gt; & Lt; / Media & gt; & Lt; / Guides & gt; & Lt; / XF: Examples & gt;   

I have the following removal action in my past to remove the previous media element

     

But it does not work.

I have also tried to change xpath

  & lt; Xf: delete delete: event = "Xforms-submit" nodeset = "media" on = "last ()" />   

and wrapping it in one action

  and  & Lt; / XF: Action & gt;   

But still no joy!

The format is valid and you can save data, just that the second media element still appears in the final XML data

On an estimate, your initial problem is that your XPath expressions are not selecting the element that you want to delete The expression "guide / media" is not to choose anything (unless that is not something important that you are not showing us), because "guide" is the outermost element of the example, and this is the default reference node in XPath.

The rules for identifying the goal of removal are quite complex that I have never learned them and every time I need to destroy anything. But the easiest way to do a deletion (at least for me) is to identify the nodes to be removed in the nodeset attribute and leave it at 'at', then if it were mine I would try < Pre> & lt; Xf: delete ev: event = "..." nodeset = "media [last] ()]" />

You should also check to ensure that your listener is actually listening to the event. Putting a message in a single action is a good way to do this, while debugging - if you do not get the message, then it is clear that you have an incident binding problem and XPath problem (or not just).

No comments:

Post a Comment