myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "JavascriptWithJavaServceFaces" by ChutYee
Date Tue, 08 Nov 2005 11:38:37 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by ChutYee:
http://wiki.apache.org/myfaces/JavascriptWithJavaServceFaces

------------------------------------------------------------------------------
  }
  return false;
  " 
- id="userForm:lnkDeleteUser">delete</a>
+ id="userForm::lnkDeleteUser">delete</a>
  -------------------------------------------------------------------------------------
  
  There are a few points to note:
@@ -38, +38 @@

   * The <h:commandLink> is rendered as a hyperlink, <a href /> 
   * The hyperlink itself is “#”, it is basically a dummy value. 
   * JSF generates a block of Javascript and it is tied to the ‘onclick’ event. Disregarding
the details, it basically calls submit() which post the form to the server. 
-  * Line 3 is of particular interest – the id of this particular component (“userForm:lnkDeleteUser”)
is saved in a hidden field. This is how the JSF engine knows which particular component does
the postback and to invoke at the server side actions appropriately. 
+  * Line 3 is of particular interest – the id of this particular component (“userForm::lnkDeleteUser”)
is saved in a hidden field. This is how the JSF engine knows which particular component does
the postback and to invoke at the server side actions appropriately. 
  
  Most JSF component allows us to inject javascript associated with various client side DHTML
events like onclick, ondoubleclick, onfocus etc. With <h:commandLink>, since JSF is
already generating Javascript associated with the onclick event, this is where we need to
inject our own javascript functions as well.
  
@@ -55, +55 @@

  "if (!confirm('Are you sure you want to delete this record?')) 
          return false; 
  clear_userForm();
- document.forms['userForm'].elements['userForm:_link_hidden_'].value='userForm::lnkDeleteUser';
+ document.forms['userForm'].elements['userForm::_link_hidden_'].value='userForm::lnkDeleteUser';
  if (document.forms['userForm'].onsubmit){
        if (document.forms['userForm'].onsubmit()) 
  document.forms['userForm'].submit();
@@ -64, +64 @@

  }
  return false;
  " 
- id="userForm:lnkDeleteUser">delete</a>
+ id="userForm::lnkDeleteUser">delete</a>
  -------------------------------------------------------------------------------------
  
  Another point to note is that the javascript block should not return true under any circumstance.
It is does so, the browser will proceed to perform <a href=”#”> – which is redirecting
the browser to the dummy “#” page.

Mime
View raw message