Grzegorz Kossakowski wrote:
Ralph Rauscher napisaĆ(a):
Thanks Grzegorz! Actually I was thinking about using Unions. In my case
however this would make things more complicated. One of several reasons
being that the selection list for my A widget gets filled dynamically.
Now the set of possible values for my A widget is pretty much unlimited.
That way I cannot setup union cases in my model as I do not know all
possible values up-front.
I see.
Anyone knows if removing a selection list from a widget is possible or
maybe if it's intentional that there's no such possibility?
I've peeked at Field's code and do not see any obvious place where setting
empty selection list could be blocked somehow. Look at this:
/**
* Set this field's selection list.
* @param selectionList The new selection list.
*/
public void setSelectionList(SelectionList selectionList) {
if (selectionList != null &&
selectionList.getDatatype() != null &&
selectionList.getDatatype() != getDatatype()) {
throw new RuntimeException("Tried to assign a SelectionList that is not
associated with this widget's datatype.");
}
this.selectionList = selectionList;
getForm().addWidgetUpdate(this);
}
I think that setting null selection list is completely valid. Are you sure you
do everything correctly?
You are right - it's setting the selection list outside the if
statement. Didn't notice that when initially looking at the code.
Actually I was still having another problem because flowscript gave me an
org.mozilla.javascript.EvaluatorException: The choice of Java method
org.apache.cocoon.forms.formmodel.Field.setSelectionList matching
JavaScript argument types (null) is ambiguous; candidate methods are:
void setSelectionList(java.lang.String), void
setSelectionList(org.apache.cocoon.forms.datatype.SelectionList)
However, I solved that using
filterValueWidget["setSelectionList(org.apache.cocoon.forms.datatype.SelectionList)"](null);
It's working now.
Thank you very much for your assistance Grzegorz.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]