Designing and Implementing Composite Applications : webMethods CAF and OpenCAF Development Help : Understanding the Client-side Model : CAF.Command.Model
CAF.Command.Model
UI command controls extend the CAF.Link.Model with the CAF.Command.Model. A CAF.Command.Model's value is the control's ID. The raise() method is also available on the CAF.Command.Model. The raise() method makes the link active and simulates a click on the link by a user. The CAF.Command.Model has a go(params) method that enables you to invoke the command directly, without simulating a user click action on the command button or link with the specified request parameters. For example, create a HiddenCommand with an server-side ID of myCommandId, and set a simple output Button, and set its onclick property to the following:
When the user clicks the Button it submits the containing form using the HiddenCommand, with myParam1 and myParam2 as request parameters.
CAF.model('#{activePageBean.clientIds['myCommandId']}').go({
myParam1: "My Value One",
myParam2: "My Second Value"
});
The CAF.Command.Model enables registering the client-side action-listeners, which are invoked when the command in initiated after the form has been validated but before it is submitted. A client-side action-listener is a method that accepts one argument, the client-side ID of the command control. If the action-listener returns false, the command aborts and the form is not submitted. For example, the following JavaScript code adds an action-listener to the command with a server-side ID of myCommandId, and aborts the processing of the command until the command has been invoked five times:
var g_myAnnoyingCount = 0;
CAF.model('#{activePageBean.clientIds['myCommandId']}').addActionListener(function(id) {
return (g_myAnnoyingCount++ > 5);
});
For more information about CAF controls, see the webMethods CAF Tag Library Reference, as described in Finding Information about CAF Controls.
Copyright © 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback