asif_zzz wrote:
> Hi,
> Im new to cocoon. Im using cocoon 2.1.10 CForms.
> In my page ,i've a textarea,button and a list.
> I've already enabled ajax in my CForm.
>
> When i press that button, i need add the information(Java class object) to
> list using ajax.
>
> Im processing the list using repeaters to show the information.
>
> Anyone please help me to sort it out the above issue.
>
> Regards,
> Aashik.
>
Hello,
If i get it right ... you want to add that list of java object to the
selectionlist when u press that button
Well for doing that add fd:on-action for that button in your forms
definition file.. for e.g
<fd:action id="changeList">
<fd:label><i18n:text>SOME_KEY</i18n:text></fd:label>
<fd:on-action>
<fd:java
ref="com.package.structure.ChangeSelectionListListener"/>
</fd:on-action>
</fd:action>
And that listener class will look like this
public class ChangeSelectionListListener implements
org.apache.cocoon.forms.event.ActionListener {
public void actionPerformed(final ActionEvent event) {
if
(event.getSourceWidget().getName().equalsIgnoreCase("changeList")) {
// get your selection list .. lets say the widget id for
that is list
final Field taskTypeField = (Field)
event.getSourceWidget().getForm().getChild("list");
taskTypeField.setState(org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
final StaticSelectionList selectionList = new
StaticSelectionList(taskTypeField.getDatatype());
for(iterate over the values u want to add ){
selectionList.addItem(your iterator value, new
I18nMessage(your iterator value, new String[] {}, path to your i18n
dictionary));
}
taskTypeField.setSelectionList(selectionList);
}
}
}
So this listener will set the selectionlist when u press that button ..
you can also put the listener 's logic in <fd:javascript> in the form
definition file instead of using the java class ..
Hope that helps
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]