You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Jue <te...@gmail.com> on 2006/09/07 23:43:33 UTC

Form action not

Hello,
I'm going through the last part in Chapter 10 of Enjoying Web
Development with Tapestry (for tap 4).
When I put the javascript calling code into a separate component, the
form action in the main page is not showing up in the component.  It's
hard to be more complete and concise than tapestry, so here is the
code:


Home.html
<html>
<body jwcid="@Body">
<form  jwcid="@Form" action="http://www.foo.com">
<input jwcid="deleteButton@ConfirmButton"  msg="Are you sure?"
type="submit" value="Delete"/>
</form>
</body>
</html>


Home.page
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification>
</page-specification>


ConfirmButton.html
<html>
<body jwcid="$content$">
<input jwcid="button" type="submit"/>
<span jwcid="insertConfirmScript"/>
</body>
</html>


ConfirmButton.jwc
<?xml version="1.0"?>
<!DOCTYPE component-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<component-specification allow-body="no" allow-informal-parameters="yes">
    <parameter name="msg" required="yes"/>
    <component id="insertConfirmScript" type="Script">
        <binding name="script" value="literal:Confirm.script"/>
        <binding name="msg" value="msg"/>
        <binding name="button" value="components.button"/>
    </component>
    <component id="button" type="Submit" inherit-informal-parameters="yes"/>
</component-specification>

Confirm.script
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script PUBLIC
"-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
<script>
<input-symbol key="msg" required="yes"/>
<input-symbol key="button" required="yes"/>
<let key="funcName" unique="yes">getConfirmation</let>
<body>
function ${funcName}() {
return confirm("${msg}");
}
</body>
<initialization>
document.${button.form.name}.${button.name}.onclick=${funcName};
</initialization>
</script>


This is the resulting html source code with the button:
<html>
<body>
<script type="text/javascript"
src="/IEIS/app?digest=557f2081d45a7528f898e7e384717596&amp;path=%2Forg%2Fapache%2Ftapestry%2Fform%2FForm.js&amp;service=asset"></script>
<script type="text/javascript"><!--
function getConfirmation() {
return confirm("Are you sure?");
}
// --></script>
<form method="post" action="/IEIS/app" name="Form" id="Form">
<div style="display:none;"><input type="hidden" name="formids" value="button"/>
<input type="hidden" name="component" value="$Form"/>
<input type="hidden" name="page" value="Home"/>
<input type="hidden" name="service" value="direct"/>
<input type="hidden" name="submitmode" value=""/>
<input type="hidden" name="submitname" value=""/>
</div>
<input type="submit" name="button" id="button" value="Delete"/>
</form>
<script language="JavaScript" type="text/javascript"><!--
Tapestry.register_form('Form');
document.Form.button.onclick=getConfirmation;
Tapestry.set_focus('button');
// --></script></body>
</html>


Notice that the action is now "IEIS/app" which is the root of my application.
My intention is that it should be "http://www.foo.com", as stated in Home.html

Any ideas?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org