Walter,
Thanks. I'll try it out and let you know.
-Richard
Walter Mourão wrote:
Hi Richard,
I suppose you're not using the PPR API to show the "Loading..."
message. If so the message should appear only after the client
validation. I suggest you start using the PPR start/stop events. From
the developer's guide:
Monitoring AJAX requests
If you want to be notified when the client is busy waiting for an AJAX
response, add a "state change listener" to the request queue:
TrPage.getInstance().getRequestQueue().addStateChangeListener(myCallback);
Your callback will be passed a single parameter, which will be either
TrRequestQueue.STATE_READY or TrRequestQueue.STATE_BUSY, depending on
the current state of the request queue. The statusIndicator component
uses exactly this mechanism to know when to start and stop spinning
its indicator. You can optionally pass a second parameter to
addStateChangeListener() for the "this" you want active when your
callback is notified.
Sample code:
<script type="text/javascript">
// <![CDATA[
function myCallback(state){
if(state == TrRequestQueue.STATE_BUSY) {
//START OF PPR
} else if(state == TrRequestQueue.STATE_READY){
//END OF PPR
}
}
TrPage.getInstance().getRequestQueue().addStateChangeListener(myCallback);
// ]]>
</script>
I hope it helps.
--
Walter Mourão
http://arcadian.com.br
http://waltermourao.com.br
2008/1/31, Richard Yee <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>:
Everyone,
I am showing a "Loading...." message when the user submits a form
in my MyFaces/Trinidad application by having an onclick
handler set the 'display' style to be 'inline' for my a
tr:outputText tag. This works fine unless there is a validation
error on the page for a required field. In this case, the
JavaScript code for Trinidad detects the empty field and the page
is not submitted. My "Loading..." message is still displayed
however. Is there a way to hook into the Trinidad JavaScript
validation code so that I can have one of my JavaScript functions
set the display style back to none in this case?
Thanks,
Richard