Problem in running JavaScript- CAF


I’m doing with a sample web App. In the process, trying to invoke a JavaScript, from the client side event ( mouse click ) of a “Command Button”.

The JavaScript is for setting a value of the OutputText field in the form.

CAF.model(‘#{activePageBean.clientIds[‘outputID’]}’).setValue(“After click”);

here, the “outputID” is the server-side ID for the OutputText field( whose value i want to change with the script )

The above script was written in my client side events property of the Command Button.

When I click the button the script is to be executed. And it is happening :happy:… but only for a fraction of Second:(. The page/value is getting refreshed very quickly to the old value( the value which is there before click)

Please help me out, in getting how to use JavaScripts exactly.

Thank you,

I think changing the control type to an Async Command button and given the refresh region to some other regions in the portlet which does not include the
“outputID”-contol should solve the issue…

Hello, how can i call the client side events from the java code??