Buttons
The CodeIgniter Form Helper provides a form_submit button function call. In order to encourage consistency, the ClearOS framework added a number function calls that map to standardized buttons. It is confusing for the end user to see an Update button on one form and then a Save button on a different form when these two buttons do the same thing! Using form_submit is strongly discouraged (read: don't do it!) so use one of the standard or custom buttons listed here.
From an end user perspective, buttons and anchors often look and do similar things. You will need to use an anchor to link to a routed URL (e.g. an Edit anchor for /app/users/edit/mary)
Standard Buttons
Functions
Button | Function |
---|---|
Add | form_submit_add(name, importance, attributes = NULL) |
Delete | form_submit_delete(name, importance, attributes = NULL) |
Update | form_submit_update(name, importance, attributes = NULL) |
Parameters
name
The name of the submit button. Using “submit” is very common, but you can be more descriptive if you wish.
importance
The importance level of the button: 'low' or 'high'. On certain forms, you may want to highlight a particular button while downplay another. For example, when an administrator goes to edit user “sarah” and is presented with the web form to do so, the “Update” button should be more prominent than “Cancel”.
attributes (optional)
Optional HTML attributes to be passed to the button. We do not want to encourage using the attributes array, so please send us a quick note about why you need it.
Examples
form_submit_add('submit', 'high'); form_submit_delete('delete_this_thing', 'low');
Custom Button
Functions
In some cases, you may need to have custom text on a button. You can use the form_submit_custom function call for this purpose. It is similar to the standard buttons, but the text for the button
Button | Function |
---|---|
Custom | form_submit_custom($name, $text, $importance, $attributes = NULL) |
Parameters
name
The name of the submit button. Using “submit” is very common, but you can be more descriptive if you wish.
text
The text that will appear on the button. Please use the lang() translation tool for this.
importance
The importance level of the button: 'low' or 'high'. On certain forms, you may want to highlight a particular button while downplay another. For example, when an administrator goes to edit user “sarah” and is presented with the web form to do so, the “Update” button should be more prominent than “Cancel”.
attributes (optional)
Optional HTML attributes to be passed to the button. We do not want to encourage using the attributes array, so please send us a quick note about why you need it.
Examples
form_submit_custom('hello', lang('example_hello_world'), 'high'); form_submit_custom('submit', lang('base_yearly'), 'high');
Links
- Anchors