JSF richfaces getElementById

jsfrichfaces

I am using jsf2 and richfaces 4.X how can i get the richfaces enabled input field's current value ? equal to getElementById('field_name').vlue

I tried some of the methods named like findcomponent.value and element.value but they give me old value which was while page was loaded b/c findcomponent and element method returns server side UI.components instead client side components ?

Best Answer

I guess you are to use rich:clientId function to render a correct identifier into your java script.

For example:

var myElement = document.getElementById("#{rich:clientId('field_name')}");

See also RichFaces rich:clientId within facelets

Related Topic