You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Diego <di...@gmail.com> on 2007/03/14 17:21:41 UTC

Select/Option not working with Ajax in IE6

I want to have a list where I can select muliple values and then update some
overview of the selected items by means of Ajax.
This works in firefox, but it doesn't work in IE6.
I use the EventListener to bind the dojo event and its with Tapestry 4.1.1.

Anybody know how this could work in IE6 too?
See example below.

Regards,
Diego


****** TestPage2.html

<span jwcid="$content$">
    <span jwcid="@Shell"  title="Test" consoleEnabled="true"
parseWidgets="true">
    <span jwcid="@Body">
        <DIV class="CenterColumn" jwcid="centercolumn@Any" >

            <form jwcid="f1@Form"
updateComponents="ognl:{'selectionresult'}">
                <div jwcid="selectionresult@Any">
                           <span jwcid="@Insert"
value="ognl:selectedColors"/>

                 </div>

             <label jwcid="@FieldLabel" field="component:colorChooser"
displayName="Choose a color">Color</label>
             <DIV class="TreeContentI" jwcid="colorSelection@Any">

                 <select jwcid="colorChooser@Select"  multiple="true"
size="4" >
                      <span jwcid="@For" source="ognl:colors"
value="ognl:currentColor" index="ognl:currentColorIndex" renderTag="false" >
                           <option jwcid="@Option"
selected="ognl:selection[currentColorIndex]"
id="ognl:'ddd'+currentColorIndex"  label="ognl:currentColor"/>
                      </span>
                 </select>

              </DIV>
            </form>

        </DIV>
    </span>
</span>


****** TestPage.java
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.annotations.EventListener;
import org.apache.tapestry.annotations.InitialValue;
import org.apache.tapestry.html.BasePage;

public abstract class TestPage2 extends BasePage {

    private String[] colors = { "blue", "red", "green", "yellow" };

    public abstract int getCurrentColorIndex();

    public abstract String getCurrentColor();

    @InitialValue("new boolean[colors.length]")
    public abstract boolean[] getSelection();

    public abstract void setSelection(boolean[] selection);

    public String[] getColors() {
        return colors;
    }

    /**
     * Listen for when an item from a list is selected
     *
     * @param cycle
     */
    @EventListener(events = { "onmouseup" }, targets = "colorSelection",
submitForm = "f1", async = true)
    public void selectFromList2(IRequestCycle cycle) {

    }

    public String getSelectedColors() {
        String out = "";
        for (int i = 0; i < colors.length; i++) {
            if (getSelection()[i]) {
                out += colors[i] + " - ";
            }

        }
        return out;
    }

}