As a follow up, I've created a very simple ajax page, included below.
I want the clear button to display an alert, and if they hit cancel,
stop the request. This does not happen even with this trivial example.
The onClear will be called regardless of what button is clicked. This
fails under IE, FireFox and Safari.
// Test.java
package com.myasd.www.obit;
import org.apache.tapestry.IExternalPage;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.html.BasePage;
public abstract class Test extends BasePage implements IExternalPage {
@Persist("session")
public abstract String getTest();
public abstract void setTest(String in);
public void activateExternalPage(Object[] parameters, IRequestCycle
cycle) {
setTest("activateExternalPage");
}
public void onQuery() {
System.out.println("On Query!");
setTest("onQuery");
}
public void onClear() {
System.out.println("On Clear!");
setTest("onClear");
}
}
// Test.page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification>
<component id="query" type="Submit">
<binding name="action" value="listener:onQuery" />
<binding name="async" value="literal:true" />
<binding name="value" value="literal:Search" />
<binding name="updateComponents" value="ognl:
{ components.test.clientId }" />
</component>
<component id="clear" type="Submit">
<binding name="action" value="listener:onClear" />
<binding name="async" value="literal:true" />
<binding name="value" value="literal:Clear" />
<binding name="updateComponents" value="ognl:
{ components.test.clientId }" />
</component>
</page-specification>
// Test.html
<html jwcid="@Shell" title="Test">
<body jwcid="@Body">
This is a test of AJAX.
<form jwcid="[EMAIL PROTECTED]">
<div jwcid="[EMAIL PROTECTED]">
<span jwcid="@Insert" value="ognl:test">Nope</span>
</div>
<input jwcid="query" /><input jwcid="clear" />
</form>
</body>
<script type="text/javascript">
dojo.event.connect(dojo.byId('clear'), 'onclick',
function (evt) {
if (!confirm('Are you sure?')) {
dojo.event.browser.stopEvent(evt);
return false;
}
return true;
}
)
</script>
</html>
Norman Franke
Answering Service for Directors, Inc.
www.myasd.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]