Monday, May 3, 2010

Inline javascript in adf faces and calling it using adf faces button component

Short tutorial to add javascript code into your adf faces page and calling it by on button press.
1. Create new Jsf page.
2. Find "Resource" from "Component Paletter --> Operations", and click on it you will be prompted to input in a dialog, click on dropdown array and select "javascript" and click OK.

3. Click on source, you will see the source with "Resource" tag like follows


4. Edit the tag and write your javascript, I am just creating a function which will show the alert dialog.

5. click on Design, and drag button so that you can call function on button click .
6. click on button, click on "component palette-->Operations" find "Client Listener" and click on it. You will be prompted to enter "method" and "type", enter your javascript method name and select type javascript and click on OK button.

7. If you see the source it would be like


8. Now click on page and run the page, when click on button it runs the javascript function.


Note: these are basic tutorials for beginners, I am sharing what I am learning.

Cheer...!








No comments:

Post a Comment