Insert Trouble!

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Insert Trouble!

Jim Logan-3
I'm having trouble getting something to work. I'm trying to build a form that allows the user to query for an existing Person to link to the entity being edited. The way I envision it working is as follows:
  • The person's name would display, read-only, on the form, with a button that allows the user to change it to another person. Alternatively, when there is no person assigned, that button would allow the user to assign a person.
  • When the user presses the button, the form would change to include a mini-form for querying by some set of attributes, a query button, and an empty table to show the matching people.
  • On every row of that table would be a button that allows the user to select that row, change the assigned person, and return to the state in the first bullet, above.
I have all of the pieces working except for inserting the selected row into a temporary instance to wrap the selected row in an XML element, and then inserting that temporary instance into the main instance. I'm stuck on inserting the selected row into a temporary instance.

The snippet of what I have for the table is this:
<xforms:repeat nodeset="instance('authorities')/auth:Authority">
	<tr>
		<td><xforms:trigger>
			<xforms:label>Select</xforms:label>
			<xforms:action ev:event="DOMActivate">
				<!-- Insert into main document and toggle -->
				<xforms:insert
					context="instance('new-authority')"
					nodeset="auth:Authority"
					origin="." />
				<xforms:toggle case="not-changing" />
			</xforms:action>
		</xforms:trigger></td>
		<td><xforms:output ref="rdfs:label" /></td>
		<td><xforms:output ref="@mdp:id" /></td>
	</tr>
</xforms:repeat>
  
When I press the "Select" button, I think it should be copying one of the rows from this list of authorities:
<xforms:instance id="authorities">
	<DefaultViewpoint:Default_root>
		<auth:Authority
			mdp:id="http://www.modeldriven.org/2008/ArchitectureOntology/Samples/SampleVersions.owl#Cory">
			<rdfs:label>Cory</rdfs:label>
		</auth:Authority>
		<auth:Authority
			mdp:id="http://www.modeldriven.org/2008/ArchitectureOntology/Samples/SampleVersions.owl#Jim">
			<rdfs:label>Jim</rdfs:label>
		</auth:Authority>
		<auth:Authority
			mdp:id="http://www.modeldriven.org/2008/ArchitectureOntology/Samples/SampleVersions.owl#Jeff">
			<rdfs:label>Jeff</rdfs:label>
		</auth:Authority>
	</DefaultViewpoint:Default_root>
</xforms:instance>

  
into this temporary instance:
<xforms:instance id="new-authority">
	<auth:responsible_party>
		<auth:Authority mdp:id="TBD">
			<rdfs:label>TBD</rdfs:label>
		</auth:Authority>
	</auth:responsible_party>
</xforms:instance>
  
but the instance inspector tells me I'm getting this instead:
<auth:responsible_party>
	<auth:Authority mdp:id="TBD">
		<rdfs:label>TBD</rdfs:label>
	</auth:Authority>
	<auth:responsible_party>
		<auth:Authority mdp:id="TBD">
			<rdfs:label>TBD</rdfs:label>
		</auth:Authority>
	</auth:responsible_party>
</auth:responsible_party>
  
It looks like it is copying from the temporary instance back into itself!

Could someone please tell me what I'm doing wrong?

Also, does anyone have a better way to query for an entity to link to the entity being edited than what I've described in the bullets above?

Thanks,
-Jim




--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Insert Trouble!

Jim Logan-3
Jim Logan wrote:

The snippet of what I have for the table is this:
<xforms:repeat nodeset="instance('authorities')/auth:Authority">
	<tr>
		<td><xforms:trigger>
			<xforms:label>Select</xforms:label>
			<xforms:action ev:event="DOMActivate">
				<!-- Insert into main document and toggle -->
				<xforms:insert
					context="instance('new-authority')"
					nodeset="auth:Authority"
					origin="." />
				<xforms:toggle case="not-changing" />
			</xforms:action>
		</xforms:trigger></td>
		<td><xforms:output ref="rdfs:label" /></td>
		<td><xforms:output ref="@mdp:id" /></td>
	</tr>
</xforms:repeat>
  
Aha! I finally got this to work by replacing the origin with
origin="instance('authorities')/auth:Authority[xxforms:index()]"
That gives me the node that corresponds to the button in the table. I didn't realize the context affected the origin as well!


I'm still curious about the following, though:
Also, does anyone have a better way to query for an entity to link to the entity being edited than what I've described in the bullets above?
Is there an example of querying for an entity to the entity being edited somewhere? Am I the only person who needs to do this kind of thing?

Thanks,
-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Insert Trouble!

Alessandro Vernet
Administrator
Hi Jim,

On Fri, May 30, 2008 at 2:34 PM, Jim Logan <[hidden email]> wrote:
> I'm still curious about the following, though:
>
> Also, does anyone have a better way to query for an entity to link to the
> entity being edited than what I've described in the bullets above?
>
> Is there an example of querying for an entity to the entity being edited
> somewhere? Am I the only person who needs to do this kind of thing?

I often see this type of UI being used, and what you described seems
entirely reasonable to me. Sometime the part of the UI that allows
users to do the search and that displays the results from the search
is shown in a dialog (xxforms:dialog), so it doesn't interfere with
the rest of the of the page.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws