Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting DOM element from JavaScript using RichFaces 4

I am currently studying a migration to RichFaces 4. From my JS, I have have to get DOM elements using

document.getElementById('myParent:myElement').

From the JBoss migration guide, I understood that "document.getElementById" can no longer be used : https://community.jboss.org/wiki/RichFacesMigrationGuide33x-4xMigration-CommonComponentsChanges.

Can somebody explain me why, and how can I (simply) change all my calls to this function - over a thousand - to something else ?

Thanks.

like image 218
user1329131 Avatar asked Jun 19 '12 13:06

user1329131


1 Answers

I suggest you to read this article: RichFaces built-in client functions

To summarize, there are 4 built in function:

  1. #{rich:clientId('id')}
  2. #{rich:element('id')}
  3. #{rich:component('id')}
  4. #{rich:findComponent('id')}

Explanation:

  • The first one permit to convert richfaces id to string.
  • The second one is used to getElementById (HTML Element)
  • The third one is used to getElementById (JavaScript Component)
  • The last to get value without a call to the managedBean
like image 76
Duff Avatar answered Oct 01 '22 15:10

Duff