myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: [Trinidad] Is there a way to have a custom JavaScript function be called when a validation error occurs?
Date Fri, 01 Feb 2008 11:46:08 GMT
not really.

in case you do a ppr submit, u could use this:
  function loader(state)
  {
    var busy = state == TrRequestQueue.STATE_BUSY;
    var div = document.getElementById("load");
    div.style.display = busy ? "inline" : "none";
    if(!busy)
    {
      TrPage.getInstance().getRequestQueue().removeStateChangeListener(loader);
    }
  }
  function addListener()
  {
    var requestQueue = TrPage.getInstance().getRequestQueue();
    requestQueue.addStateChangeListener(loader);
  }

the link/button:
<tr:commandLink id="delete" partialSubmit="true"
onclick="addListener();" ......>

On Jan 31, 2008 11:57 PM, Richard Yee <richard.k.yee@gmail.com> wrote:
> 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
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Mime
View raw message