cookies-$3.lzx

<canvas width="100%" height="100">

    <!-- dataset to set cookie with -->
    <dataset name="dsSetCookie" type="http" src="resources/cookie.jsp"/>

    <!-- Set previous set item during start -->
    <dataset name="dsGetCookie" type="http" src="resources/cookie.jsp" querystring="name=mycookie&op=get" request="true"/>
    <datapointer name="dpCookie" xpath="dsGetCookie:/info[1]/data[1]/item[1]/text()">
        <handler name="ondata" args="d">
            if (d != '') cbox1.selectItem(d);
        </handler>        
    </datapointer>


    <!-- combobox items -->
    <dataset name="items">
        <item value="item1">item one</item>
        <item value="item2">item two</item>
        <item value="item3">item three</item>
        <item value="item4">item four</item>
    </dataset>

    <combobox id="cbox1" x="20" y="20" width="130" defaulttext="choose one...">
        <textlistitem datapath="items:/item/" text="$path{'text()'}" value="$path{'@value'}">
            <!-- when item is selected, save choice in cookie by calling JSP -->
            <handler name="onclick">
            
                dsSetCookie.setAttribute("querystring", "name=mycookie&op=set&item=" + this.value);
                dsSetCookie.doRequest();
            
            </handler>
        </textlistitem>
    </combobox>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2007, 2008 Laszlo Systems, Inc.  All Rights Reserved.                   *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->

Cross References

Named Instances