Developers Documentation

×

Warning

301 error for file:https://clearos.com/dokuwiki2/lib/exe/css.php?t=dokuwiki&tseed=82873f9c9a1f5784b951644363f20ef8

User Tools

Site Tools


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

ButtonFunction
Addform_submit_add(name, importance, attributes = NULL)
Deleteform_submit_delete(name, importance, attributes = NULL)
Updateform_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

ButtonFunction
Customform_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');
content/en_us/dev_framework_reference_guide_buttons.txt · Last modified: 2015/03/01 12:16 (external edit)

https://clearos.com/dokuwiki2/lib/exe/indexer.php?id=content%3Aen_us%3Adev_framework_reference_guide_buttons&1710818590