Richard,
>to/can't use an image or a button) So the idea is to use <a
>href=...tapestry's generated action URL here...
>onclick="document.Form0.submit();">. (This worked with WebObjects BTW).
Well, we are doing something very similar. Because there are so many
potential exit points from some of our form pages, we use the onchange
action of the form elements rather than the onclick action of the controls.
But otherwise it is what you described. I'm not sure what your problem is.
Since the magic of this technique (javascript) takes place on the client, I
don't understand how Tapestry could tell the difference between forms
submitted by javascript action and forms submitted via submit button.
Anyhow, here are some fragments that should show what we do. We are using
Tapestry 2.0.5, but much of this code was written against Tapestry 1.0.8, so
there shouldn't be any dependency on new functionality:
here are our form components from the .jwc:
<component id="form" type="Form">
<binding name="listener" property-path="listeners.submitForm"/>
</component>
<component id="caption" type="TextField">
<binding name="value" property-path="photo.caption"/>
<static-binding name="onChange">_elementChanged(this)</static-binding>
<static-binding name="maximumLength">90</static-binding>
<static-binding name="displayWidth">80</static-binding>
</component>
<component id="narrativeText" type="Text">
<binding name="value" property-path="photo.narrative"/>
<static-binding name="onChange">_elementChanged(this)</static-binding>
<static-binding name="columns">80</static-binding>
</component>
and of course there is a script that goes with this:
<component id="submitScript" type="Script">
<static-binding
name="script">/com/pixory/pxapplication/pages/AlbumPageEditor.script</static-binding>
</component>
Here is the content of that file:
<body>
function _elementChanged(element)
{
try
{
document.forms[0].submit();
}
catch(errorObject)
{
}
return true;
}
</body>
That's all we did, and it just works. If the focus is in one of the form
components, let's say the user has just finished editing some text, and the
user shifts focus by clicking on an link generated by a Direct or an Action,
the form is first submitted, and then the listener associated with the link
is invoked.
I'm not sure why this wouldn't also work in the case of the onclick action
of the anchor.
Joseph Panico
[EMAIL PROTECTED]
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Stuff, things, and much much more.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer