Hello there,<br>Thanks but I think you did have it right.<br>I am trying to set the value (add property) to the value of the multi widget.<br>I do the same thing as you but it is passted below.<br>MY problem is that a JAVA developer here before me made this custom class and I just changed the sql to return my categories.
<br>I believe that for the multi values i cannot use an 'extention' of the SelectWidget but rather should be usiing the ComboBox as you are. But not being a JAVA guy and not having a day or two to spend figuring it out i was trying to get it to workwith the selectWidget.
<br>I changed the output to multiple="true" but that did not do the trick.<br><br>Here is what i am using: wuold you mind showing me the ComboBox code you are using?<br><br><br>package com.bhvr.opencms.widgets;<br>
<br>import com.bhvr.db.DBUtil;<br><br>import org.opencms.file.CmsObject;<br>import org.opencms.widgets.A_CmsSelectWidget;<br>import org.opencms.widgets.CmsSelectWidget;<br>import org.opencms.widgets.CmsSelectWidgetOption;
<br>import org.opencms.widgets.I_CmsWidget;<br>import org.opencms.widgets.I_CmsWidgetDialog;<br>import org.opencms.widgets.I_CmsWidgetParameter;<br><br>import java.util.Iterator;<br>import java.util.List;<br><br>/**<br> * Provides a widget for a standard HTML form select box.<p>
<br> * <br> * Please see the documentation of <code>{@link org.opencms.widgets.CmsSelectWidgetOption}</code> for a description <br> * about the configuration String syntax for the select options.<p><br> *
<br> * The select widget does use the following select options:<ul><br> * <li><code>{@link org.opencms.widgets.CmsSelectWidgetOption#getValue()}</code> for the <code>value</code> of the HTML select box
<br> * <li><code>{@link org.opencms.widgets.CmsSelectWidgetOption#isDefault()}</code> for pre-selecting a specific value <br> * <li><code>{@link org.opencms.widgets.CmsSelectWidgetOption#getOption
()}</code> for the <code>option</code> of the HTML select box<br> * </ul><br> * <p><br> *<br> * @author Andreas Zahner <br> * <br> * @version $Revision: 1.11 $ <br> * <br> * @since 6.0.0 <br>
*/<br>public class CmsCategorySelectWidget extends A_CmsSelectWidget {<br><br> /**<br> * Creates a new select widget.<p><br> */<br> public CmsCategorySelectWidget() {<br><br> // empty constructor is required for class registration
<br> super();<br> }<br><br> /**<br> * Creates a select widget with the select options specified in the given configuration List.<p><br> * <br> * The list elements must be of type <code>{@link CmsSelectWidgetOption}</code>.<p>
<br> * <br> * @param configuration the configuration (possible options) for the select widget<br> * <br> * @see CmsSelectWidgetOption<br> */<br> public CmsCategorySelectWidget(List configuration) {<br>
<br> super(configuration);<br> }<br><br> /**<br> * Creates a select widget with the specified select options.<p><br> * <br> * @param configuration the configuration (possible options) for the select box
<br> */<br> public CmsCategorySelectWidget(String configuration) {<br><br> super(configuration);<br> }<br><br> /**<br> * @see org.opencms.widgets.I_CmsWidget#getDialogWidget(org.opencms.file.CmsObject
, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter)<br> */<br> public String getDialogWidget(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) {<br><br> String id =
param.getId();<br> StringBuffer result = new StringBuffer(16);<br><br> result.append("<td class=\"xmlTd\" style=\"height: 25px;\"><select multiple=\"true\" class=\"xmlInput");
<br> if (param.hasError()) {<br> result.append(" xmlInputError");<br> }<br> result.append("\" name=\"");<br> result.append(id);<br> result.append
("\" id=\"");<br> result.append(id);<br> result.append("\">");<br><br> // get select box options from default value String<br>// List options = parseSelectOptions(cms, widgetDialog, param);
<br><br> DBUtil dbUtil = new DBUtil();<br> <br> javax.sql.rowset.CachedRowSet rs = dbUtil.getCachedData("java:/comp/env/jdbc/lt", "SELECT CONCAT( REPEAT('-', COUNT(<a href="http://parent.name">
parent.name</a>) - 1), <a href="http://node.name">node.name</a>) AS name,"<br> +" node.cat_id AS cat_id"<br> +" FROM categories AS node,"<br> +" categories AS parent"
<br> +" WHERE node.lft BETWEEN parent.lft AND parent.rgt"<br> +" GROUP BY node.cat_id"<br> +" ORDER BY node.lft");<br> <br> List<CmsSelectWidgetOption> options = new
java.util.ArrayList<CmsSelectWidgetOption>();<br> <br> try {<br> while (rs.next()) {<br> options.add(new CmsSelectWidgetOption(rs.getString("name"), false, rs.getString("name")));
<br> }<br> } catch (Exception e) {<br> System.err.println(e.getMessage());<br> }<br> <br> <br> <br> String selected = getSelectedValue(cms, param);<br>
Iterator i = options.iterator();<br> while (i.hasNext()) {<br> CmsSelectWidgetOption option = (CmsSelectWidgetOption)i.next();<br> // create the option<br> result.append("<option value=\"");
<br> result.append(option.getValue());<br> result.append("\"");<br> if ((selected != null) && selected.equals(option.getValue())) {<br> result.append(" selected=\"selected\"");
<br> }<br> result.append(">");<br> result.append(option.getOption());<br> result.append("</option>");<br> }<br><br> result.append("</select>");
<br> result.append("</td>");<br><br> return result.toString();<br> }<br><br> /**<br> * @see org.opencms.widgets.I_CmsWidget#newInstance()<br> */<br> public I_CmsWidget newInstance() {
<br><br> return new CmsCategorySelectWidget(getConfiguration());<br> }<br>}<br><br><br><div><span class="gmail_quote">On 10/7/06, <b class="gmail_sendername">Jonathan Woods</b> <<a href="mailto:jonathan.woods@scintillance.com">
jonathan.woods@scintillance.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Dinshaw -</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">I'm sorry; I misunderstood your question, anyway. As
far I can tell, you want the value of multiple elements to map on to a single
property, whereas in my case I was merely setting an element's 'value' (and
thereby a mapped property) using values derived from a multi-select
widget.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Are you restricted to using a PHP application layer?
If you used Java executing in the OpenCms context, you'd have far more
flexibility - e.g. Java could process the XML document instance whenever it
wanted, maybe setting a property to help in later querying for category-matching
resources. I take a different approach at <a href="http://www.colfes.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">www.colfes.com</a>: I index XML docs in Lucene, and
query the Lucene index at page rendering time (with some caching) to select
resources matching multiple categories.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">By the way, is the code to your CmsCategorySelectWidget
something you can share? I currently flatten a hierarchical value
structure and represent it in a simple SelectorWidget -
ugly!</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Jon</font></span></div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><span class="q"><b>From:</b> <a href="mailto:opencms-dev-bounces@opencms.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">opencms-dev-bounces@opencms.org</a>
[mailto:<a href="mailto:opencms-dev-bounces@opencms.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">opencms-dev-bounces@opencms.org</a>] <b>On Behalf Of </b>dinshaw
gobhai<br></span><b>Sent:</b> 06 October 2006 17:56<br><b>To:</b> The OpenCms mailing
list<br><b>Subject:</b> Re: [opencms-dev] Multiple values to a single
Property?<br></font><br></div><div><span class="e" id="q_10e2140cebaa7fbf_3">
<div></div>Hi Jon,<br>Thanks very much. I tried your sugestion and still my
values are overwritten.<br>My relevent schema lines are:<br><br><xsd:element
name="Category" type="OpenCmsString" /><br><layout element="Category"
widget="CmsCategorySelectWidget" /> <br><mapping element="Category"
mapto="property:category" /><br><br>If you have a second to see if there is
anything dumb in here (like I shouldn't be using String) that would be
great.<br>The CmsCategorySelectWidget uses a MySQL nested set modle category
table to return a tree stucture. <br>Thanks again,<br>-Dinshaw <br><br><br>
<div><span class="gmail_quote">On 10/6/06, <b class="gmail_sendername">Jonathan
Woods</b> <<a href="mailto:jonathan.woods@scintillance.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">jonathan.woods@scintillance.com</a>>
wrote: </span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Dinshaw
-</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">I use a
SelectorWidget to render a multiple-select list in a couple of my XSDs, and I
used to map the (multiple) value of this using an ordinary <mapping>
element. OpenCms populated the property with the values selected,
separating them with a comma (or was it a semicolon? can't
recall).</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Jon</font></span></div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:opencms-dev-bounces@opencms.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">opencms-dev-bounces@opencms.org</a> [mailto:<a href="mailto:opencms-dev-bounces@opencms.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
opencms-dev-bounces@opencms.org</a>] <b>On Behalf Of </b>dinshaw
gobhai<br><b>Sent:</b> 05 October 2006 18:48<br><b>To:</b> <a href="mailto:opencms-dev@opencms.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">opencms-dev@opencms.org</a><br><b>Subject:</b> [opencms-dev]
Multiple values to a single Property?<br></font><br></div>
<div><span>
<div></div>Hi there,<br>I am fairly new to OpenCMS and have found references
to that fact that i can map multiple values to a single property however I can
not find a guide as to how.<br>If anyone could point me to a reference that
would be great. <br><br>The problem is that I have a category select
list for a content type my_article.xsd that needs to occur multiple times so
that it can appear on different category pages simultaneously.<br><br>The
catch is that the system I am working on has built a php application layer to
get and parse the OpenCMS content and they sql query needs the property value
to target the articles that should be included. <br><br>Currently only the
first instance of the Category select list is mapped to the category
property.<br><br><mapping element="Category" mapto="property:category"
/><br><br>so what i was looking for (i think) was something like
<br><mapping element="Category" mapto="property:category" multiple="true"
/><br><br>But i have been unable to find it.<br><br>Any help would be
greatly appreciated.<br>Thanks,<br>-Dinshaw, NYC
<br><br></span></div></div><br><br>_______________________________________________<br>This
mail is sent to you from the opencms-dev mailing list<br>To change your list
options, or to unsubscribe from the list, please visit<br><a href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.opencms.org/mailman/listinfo/opencms-dev
</a><br><br></blockquote></div><br></span></div></div>
<br><br>_______________________________________________<br>This mail is sent to you from the opencms-dev mailing list<br>To change your list options, or to unsubscribe from the list, please visit<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">
http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br><br></blockquote></div><br>