Hello Ronald,
Default? No. My hackers instinct? Yes.
My first thought was to use xpath, but that is a not the way. The fdatapath
attribute could be used to execute xpath queries on the xml from the dove
interface. List and field currently have this attribute. You can only use
the xpath query to minimize the display of results.
But you can do some client side javascript to fill the constraint in the
wizard. You only have to detect your list in the wizard.xsl and generate
your own javascript search button The javascript should do almost the same
as the doSearch() with the difference that the constraint has the
elementtype.
Some code to get you on your way (Thank you WIAB!)
function doSearchByElementtype() {
var value = null;
var forms = window.document.forms;
for (var i=0; i<forms.length; i++) {
for (var j=0; j<forms[i].elements.length; j++) {
var el = forms[i].elements[j];
if (el.fdatapath == "[EMAIL PROTECTED]'elementtype']") {
value = el.value;
}
}
}
if (value == null || value == "") {
alert("No idea which elementtype is selected!!");
}
else {
// open search screen
}
}
<xsl:template name="listsearch">
<!-- if 'add-item' command and a search, then make a search util-box -->
<xsl:if test="[EMAIL PROTECTED]'add-item']">
<xsl:for-each select="[EMAIL PROTECTED]'search']">
<xsl:choose>
<!-- not sure the xpath is oke, but it must be close -->
<xsl:when test="../[EMAIL PROTECTED]'B' and
@role='related']">
<img type="image" src="{$mediadir}searchelementtype.gif"
onclick="doSearchElementType();"/>
</xsl:when>
<xsl:otherwise>
<!--
.....
wizard.xsl code
.....
-->
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:if>
</xsl:template>
Nico
----------------------------------------------------------------------------
-----
Nothing is impossible for the man who doesn't have to do it himself. A. H.
Weiler
________________________________
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Ronald Wildenberg
Verzonden: woensdag 21 juli 2004 11:17
Aan: [EMAIL PROTECTED]
Onderwerp: Editwizard search question
Hi,
I have a question about searching related items from a wizard. I
have an objecttype A with a field 'elementtype', which has a certain value.
This object can be linked to B objects with a field 'type'. From the wizard
for A, I'd like to search for B items that can be linked. However, in the
search results, I'd like to see only the B items that have a type that is
equal to the current elementtype of A. Is this possible?
Regards,
Ronald Wildenberg.