Basic Customization > User Interface Customization > Adding Actions and Hooking Them Up in the UI > Action Framework for Windchill Client Architecture > Defining a New Action > Command and Component Attributes
  
Command and Component Attributes
If necessary, place a <command> or <component> tag in the body of the <action> tag to define the processing aspects of the action.
<command
class="com.ptc.windchill.enterprise.doc.forms.CreateDocFormProcessor"
method="execute" windowType="popup" onClick="validateCreateLocation(event)"/>
Or:
<component name="my.component.id" windowType="page" />
The class attribute defines what class to use for processing.
The method attribute defines what method to execute in the class.
The windowType attribute determines what window action to take.
In the example above, the command is for the New Document action, which is an action window (a wizard). Therefore, the windowType is “popup.” The framework adds JavaScript that launches this action in a new window. The specified class and method are executed upon submission.
Command Parameters
Parameter
Default Value
Possible Values
Req?
Description
class
No
The class to use for processing.
method
No
The method in the class to execute.
url
No
Used to override the generated URL
This attribute can be used to specify the location of the JSP associated with the action. The value should be the path of the JSP relative to <Windchill>/codebase.
onClick
No
Specifies an additional onClick function to call. This is useful for confirming with the user whether to execute a special action.
For certain places where actions are used (such as a menu bar or the toolbar on a table), onClick needs to be a valid expression for an “if” statement. Therefore, onClick should just be a call to a function.
The following are in scope variables that the onClick function can pass as arguments:
event — The browser event
target — The object representing the user interface component that was ‘clicked’
table — The table that contains the action. This is null if the action is not contained within a table.
onClick should not contain semi-colons or return statements. For example:
Correct:
onClick="doFoo()"
onClick="doFoo(event)"
Incorrect:
onClick="doFoo();doBar();"
onclick="doFoo();Event.stop(event);"
* 
The use of the HTML-encoded character "'" to use a single quote is not necessary; just use a regular single quote instead.
When the actions are parsed, the action framework tries to repair troublesome definitions. If they cannot be repaired, then the onClick function is replaced with an alert. Warnings are logged if the action was repaired; otherwise errors are logged.
If the selectRequired attribute is set on the action, then the onClick handler is called before any other handlers. Thus, the onClick handler must check if there are items selected in the table.
windowType
page
new
no_content
normal
popup
wizard_step
No
new—Looks similar to other windows, but is launched differently. All of the form data is submitted to the popup window, making more information available. However, the extra form data might overlap with form data already in the popup. It might be easier to override the action URL to add additional information.
no_content—The browser ignores the response from the server from this request. This value is not recommended, rather create and Ajax request manually through a JavaScript function.
normal—Submits the form.
page —Display a new page.
popup—Create a non-modal popup action window.
wizard_step—Displays the action as a step in an action window.
Component attributes are very similar to the command attributes. But instead of providing a direct URL, the URL is generated given the MVC component ID. The MVC component can determine the correct URL in the MVC delegate. See MVC Components for more information.
Component Parameters
Parameter
Default Value
Possible Values
Req?
Description
name
Yes
The MVC component id that should be used to display when this action is clicked.
componentType
INFO
PICKER
SEARCH
TABLE
WIZARD
WIZARD_TABLE
WIZARD_ATTRIBUTES_TABLE
INFO_ATTRIBUTES_TABLE
SIMPLE
MINI_INFO
PRIMARY_ATTRIBUTES
No
The componentType affects whether objects rendered on the resulting page are editable, read-only, or validated out. Values are from com.ptc.core.ui.resources.ComponentType
The component type can change the URL to typeBased under certain conditions such as INFO. Some actions are only available under certain component types.
urlParams
URL parameters that are added to the generated MVC URL each time the action is rendered
typeBased
false
true
Determines if the MVC delegate lookup should include the type of object being acted upon. The MVC URL that is generated is /tcomp/ instead of /comp/ for type-based components.
onClick
No
Specifies an additional onClick function to call. This is useful for confirming with the user whether to execute a special action.
For certain places where actions are used (such as a menu bar or the toolbar on a table), onClick needs to be a valid expression for an “if” statement. Therefore, onClick should just be a call to a function.
The following are in scope variables that the onClick function can pass as arguments:
event — The browser event
target — The object representing the user interface component that was ‘clicked’
table — The table that contains the action. This is null if the action is not contained within a table.
onClick should not contain semi-colons or return statements. For example:
Correct:
onClick="doFoo()"
onClick="doFoo(event)"
Incorrect:
onClick="doFoo();doBar();"
onclick="doFoo();Event.stop(event);"
* 
The use of the HTML-encoded character "'" to use a single quote is not necessary; just use a regular single quote instead.
When the actions are parsed, the action framework tries to repair troublesome definitions. If they cannot be repaired, then the onClick function is replaced with an alert. Warnings are logged if the action was repaired; otherwise errors are logged.
If the selectRequired attribute is set on the action, then the onClick handler is called before any other handlers. Thus, the onClick handler must check if there are items selected in the table.
windowType
page
new
no_content
normal
popup
wizard_step
No
new—Looks similar to other windows, but is launched differently. All of the form data is submitted to the popup window, making more information available. However, the extra form data might overlap with form data already in the popup. It might be easier to override the action URL to add additional information.
no_content—The browser ignores the response from the server from this request. This value is not recommended, rather create and Ajax request manually through a JavaScript function.
normal—Submits the form.
page —Display a new page.
popup—Create a non-modal popup action window.
wizard_step—Displays the action as a step in an action window.