Corresponds to input type="submit", a client-side element that can force the enclosing form to submit. The submit responsible for the form submission will post a notification that allows the application to know that it was the responsible entity. The notification is named "selected" and has no context.
| Name | Type | Flags | Default | Default Prefix | Description |
|---|---|---|---|---|---|
| clientId | String | prop:componentResources.id | literal | The id used to generate a page-unique client-side identifier for the component. If a component renders multiple times, a suffix will be appended to the to id to ensure uniqueness. The uniqued value may be accessed via the clientId property. | |
| defer | boolean | prop | If true (the default), then any notification sent by the component will be deferred until the end of the form submission (this is usually desirable). | ||
| disabled | boolean | false | prop | If true, then the field will render out with a disabled attribute (to turn off client-side behavior). Further, a disabled field ignores any value in the request when the form is submitted. | |
| label | String | literal | The user presentable label for the field. If not provided, a reasonable label is generated from the component's id, first by looking for a message key named "id-label" (substituting the component's actual id), then by converting the actual id to a presentable string (for example, "userId" to "User Id"). |
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>
<h1>Edit User</h1>
<t:form>
<t:errors/>
<t:beaneditor t:id="user"/>
<p>
<input type="submit" value="Update User"/>
<t:submit t:id="delete" value="Delete User"/>
</p>
</t:form>
</html>
public class EditUser
{
@Inject
private UserDAO _userDAO;
@Persist
private User _user;
private boolean _deleteUser;
void onSelectedFromDelete() { _deleteUser = true; }
Object onSuccess()
{
if (_deleteUser)
_userDAO.delete(user.getId());
else
_userDAO.update(user);
return UserList.class;
}
public void setUser(User user) { _user = user; }
public User getUser() { return _user; }
}