cancel
Showing results for 
Search instead for 
Did you mean: 

How to build a custom component

nahanni
Champ in-the-making
Champ in-the-making
Hi,

I would like to build my owns component generators in order to execute javascript during some events (onBlur, onClick, …).

Staring with TextFieldGenerator.java component generator, I tried to add javascript for the onChange event with the line 

component.getAttributes().put("onChange", "alert('Hello !');");

But the generated page do not contains any javascript for the event. I am sure that my component generator is used as the modification I made for the maxlength attribute is visible.

Do I have to implement my own component at myFaces level by developing a my own myFaces component type and use it in a component generator with the line

      UIComponent component = context.getApplication().createComponent("my_own_component");

Thank you for your help

Dom
2 REPLIES 2

gavinc
Champ in-the-making
Champ in-the-making
We are just using the standard default text renderer that JSF provides. The JSF component is actually looking for a property called "onchange", so try changing your property name to lowercase.

nahanni
Champ in-the-making
Champ in-the-making
"onchange" in lowercase works fine. thank you.