I'm trying to make a simple form that updates a database and then shows a
success message, without reloading the page.  When I submit the form, the
server listener gets called and executes successfully every time, but the
message gets updated only every third time I click the button (and the page
may be reloading then too).  

Any idea what I'm doing wrong?


OptionsConfig.html:
 
<html jwcid="@Shell" title="Options Config">
        <script type="text/javascript">
                djConfig = { isDebug: false,
                baseRelativePath: "js/dojo/",
                preventBackButtonFix: false };
        </script>
        <script type="text/javascript" src="js/dojo/dojo.js"></script>

<body jwcid="@Body">
        <form jwcid="[EMAIL PROTECTED]:AjaxForm" >
        <table>
                <tr>
                <th>Box 1</th> <td><input jwcid="[EMAIL PROTECTED]"
value="ognl:options.box1"/>
                </tr>

                <tr>
                <th>Box 2</th> <td><input jwcid="[EMAIL PROTECTED]"
value="ognl:options.box2"/>
                </tr>
        </table>

        <input jwcid="[EMAIL PROTECTED]:AjaxSubmit" 
                value="Set" 
                action="listener:updateOptions" 
                updateComponents="ognl:{'msgArea'}"/>
        </form>

        <div jwcid="@Any" id="msgArea">
                <span jwcid="[EMAIL PROTECTED]" value="ognl:message"></span>
        </div>
</body>
</html>


OptionsConfig.java:

public abstract class OptionsConfig extends BasePage implements
PageBeginRenderListener {

        public abstract Options getOptions();
        public abstract void setOptions(Options options);
        
        public abstract String getMessage();
        public abstract void setMessage(String msg);

        public void updateOptions() {
                getOptions().save();
                setMessage("Settings saved.");
        }

        public void pageBeginRender(PageEvent event) {
                setOptions(Options.load()); 
        }

}


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Tacos-devel mailing list
Tacos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tacos-devel

Reply via email to