cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From imran <>
Subject Re: How to do ajax in Cforms
Date Wed, 15 Oct 2008 13:18:38 GMT
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.


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">

And that listener class will look like this

public class ChangeSelectionListListener implements
org.apache.cocoon.forms.event.ActionListener {

    public void actionPerformed(final ActionEvent event) {
(event.getSourceWidget().getName().equalsIgnoreCase("changeList")) {

                // get your selection list .. lets say the widget id for
that is list
                final Field taskTypeField = (Field)
                final StaticSelectionList selectionList = new
                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

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:
For additional commands, e-mail:

View raw message