This post is next in series of "Working with ADF Faces Components programmatically"
So this post is about creating client Attribute, applying it to component and setting it's value programmatically
this requirement comes in picture when user is dealing with dynamic layout means components are created programmatically at run time and it is not possible to apply clientAttribute and other properties declarative
In this i am extending my previous post -
In previous post i have described about applying client listener and server listener programmatically
here we will see how to pass a variable value to java script function using client attribute
You can read more about af:clientAttribute here
From oracle docs-
The clientAttribute tag specifies the name/value for an attribute which will both be made available both on the server-side (Faces) component as well on on the client-side equivalent. This tag will be ignored for any server-rendered components, as it is only supported for the rich client. ClientAttributes are not synchronized to the server since unknown attributes from the client are not synchronized to the server.
Lets' see how we can do this ,It's simple just check this code -
Here i am not writing code to apply client/server listener again , refer previous post for that
See the code to add client attributes to component (inputText)
So all done , now check it
this method is called using client listener on input text and see the alert messages
First client attribute value-
Cheers :) Happy Learning