2011-05-06, 09:34 AM
Probably this has been asked more times but for me is still very difficult to find information.
So, anyone knows a place to look for all available possibilities for optionscode parameter for forms elements. If it is a documentation with explanation on each possible value and examples, it would be fantastic.
Besides I'm looking for these ones so maybe someone can point me too to a file included in mybb that contains examples or a plugin that uses any of this form elements: a hidden form element, a multiselect forum (this one I know is on some file for the search function), a multiselect for user groups, a multiselect for users.
I start myself with the optionscode values I know.
yes/no switch
text input
text area
Custom radio buttons
Similar to radios, select combobox
I don't know how to use checkboxes. If I create one of those it acts as multiselect checkboxes, but when I save the settings only the last option is saved. If you only need one value, a simple checkbox, then you would not have the problem of multiselects and works fine.
This would be the code, but the logic is not working properly, so this need something more I don't know.
So, anyone knows a place to look for all available possibilities for optionscode parameter for forms elements. If it is a documentation with explanation on each possible value and examples, it would be fantastic.
Besides I'm looking for these ones so maybe someone can point me too to a file included in mybb that contains examples or a plugin that uses any of this form elements: a hidden form element, a multiselect forum (this one I know is on some file for the search function), a multiselect for user groups, a multiselect for users.
I start myself with the optionscode values I know.
yes/no switch
$new_setting = array(
'name' => 'setting_yesno',
'title' => 'yes/no switch',
'description' => 'A yes/no switch. Radios with two options yes/no. Values 0/1',
'optionscode' => 'yesno',
'value' => '0',
'disporder' => 0,
'gid' => $my_settings_group
);
This is available too as on/off, changing the value of optionscode'optionscode' => 'onoff',
text input
$new_setting = array(
'name' => 'setting_text',
'title' => 'Text input',
'description' => 'A text input box to enter simple text options',
'optionscode' => 'text',
'value' => '',
'disporder' => 0,
'gid' => $my_settings_group
);
text area
$new_setting = array(
'name' => 'setting_text_area',
'title' => 'Text area',
'description' => 'A text area to input more than one line text',
'optionscode' => 'textarea',
'value' => '',
'disporder' => 0,
'gid' => $my_settings_group
);
Custom radio buttons
$new_setting = array(
'name' => 'setting_radio',
'title' => 'Radio buttons',
'description' => 'Radio buttons choice options',
'optionscode' => 'radio \n 1=option1 \n 2=option2 \n 3=option3',
'value' => '1',
'disporder' => 0,
'gid' => $my_settings_group
);
Similar to radios, select combobox
$new_setting = array(
'name' => 'setting_select',
'title' => 'Select combobox',
'description' => 'Select combobox to choose an option',
'optionscode' => 'select \n 1=option1 \n 2=option2 \n 3=option3',
'value' => '1',
'disporder' => 0,
'gid' => $my_settings_group
);
I don't know how to use checkboxes. If I create one of those it acts as multiselect checkboxes, but when I save the settings only the last option is saved. If you only need one value, a simple checkbox, then you would not have the problem of multiselects and works fine.
This would be the code, but the logic is not working properly, so this need something more I don't know.
Quote:$new_setting = array(Maybe there is a way to indicate it is multiselect or not multiselect??
'name' => 'setting_checkboxes',
'title' => 'Checkboxes',
'description' => 'Checkboxes to choose an option',
'optionscode' => 'checkbox \n 1=option1 \n 2=option2 \n 3=option3',
'value' => '1',
'disporder' => 0,
'gid' => $my_settings_group
);