Christofer Dutz napisaƂ(a):
Hi Grzegorz,

Thanks for your reply. In general your Idea sounds good. Could you explain
what you mean by "seting an attribute of zip"? Is it possible to add
additional attributes to a field? How can I access them when generating the
suggestion-list. Is there any sample code showing this?

Every CForms widget can have a collection of attributes, see [1].
Your country widget should look like:
<fd:field id="country">
<fd:on-value-changed>
<fd:javascript>
event.sourceWidget.lookupWidget("../zip").setAttribute("country", event.sourceWidget.value);
<fd:javascript>
</fd:on-value-changed>
</fd:field>

Taking a quick look on source of JavaScriptSelectionListBuilder[2] it seems that there is no way to access a widget object from implementation of suggestion-list. However, there is dirty workaround for this. You can put your form instance in viewdata in flowscript and then access it in from javascript code.

<fd:field id="zip">
<fd:suggestion-list type="javascript">
//your javascript code
</fd:suggestion-list>

I have to think about it for a while, maybe come with better solution.

[1] http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Widget.html [2] http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/datatype/JavaScriptSelectionListBuilder.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to