Executing JavaScript within an event response
Executing JavaScript within an event response can be very useful when you have a JavaScript library that does certain things on the client side, and you want to call these functions after finishing an action on the server side.
In this recipe, we will simply add a warning message to the Phone Number
component if the user enters anything other than a number as the first letter and return the focus to the component again. You can refer to the last recipe to do this, or you also can grab this project's recipe by cloning the ADFFacesServerClientEvents
application from the Git repository.
How to do it…
To learn how to execute a script within an event response, follow the ensuing steps:
Open the
events.jsf
page.Drag the
PhoneNumber
field by navigating to Chapter7DataControl | EmployeesView1 and drop it inside the panel form layout by navigating to Text | ADF Input Text w/ Label.Select the
PhoneNumber
field from the Structure pane.Change the
AutoSubmit
...