Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Add javascript function to customized component  RSS feed

 
daniele licitra
Ranch Hand
Posts: 81
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all.

I've extended <p:inputText> in my <my:myinputText> and now i want to add a javascript method to this element:
when i press return, i must go to next form component and not to submit the form (like most desktop application).
Another behaviour that i want to add to my element is: when i leave the input text i want to validate the content of the field.

How can i modify the two classes MyInputText and MyInputTextRenderer to gain this new features?

my component class code is:


and the render code is


the javascript function is in scripts.js

Thanks in advance
(Sorry for my ugly english)
 
daniele licitra
Ranch Hand
Posts: 81
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it!

I added to java class of the component the methds:


JS_NO_SUBMIT contains the javascript code.


New task: how i can include js library file in the component (maybe with renderer) to specify only the function name instead of funcion code?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!