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...!








Comments

  1. Thank you good post
    Can you provide source code for this?

    ReplyDelete

Post a Comment

Popular posts from this blog

Unable to create a server socket for listening on channel "Default[4]". The address 0:0:0:0:0:0:0:1 might be incorrect or another process is using port 8001: java.net.BindException: Address already in use: JVM_Bind.

[Deployer:149164]The domain edit lock is owned by another session in exclusive mode - hence this deployment operation cannot proceed.

weblogic.application.ModuleException: Exception preparing module: EJBModule(ModelEJB.jar) No EJBs found in the ejb-jar file 'ModelEJB.jar'. Please ensure the ejb-jar contains EJB declarations via an ejb-jar.xml deployment descriptor or at least one class annotated with the @Stateless, @Stateful or @MessageDriven EJB annotation..'