A small plugin for Frappe that adds the support of options group to the select control.
- Frappe >= v13.0.0
Do not forget to replace [sitename] with the name of your site in all commands.
- Go to bench directory
cd ~/frappe-bench
- Get plugin from Github
(Required only once)
bench get-app https://github.com/kid1194/frappe-better-select-control
- Build plugin
(Required only once)
bench build --apps frappe_better_select_control
- Install plugin on a specific site
bench --site [sitename] install-app frappe_better_select_control
- Check the usage section below
- Go to app directory
cd ~/frappe-bench/apps/frappe_better_select_control
- Get updates from Github
git pull
- Go to bench directory
cd ~/frappe-bench
- Build plugin
bench build --apps frappe_better_select_control
- Update a specific site
bench --site [sitename] migrate
- Restart bench
bench restart
- Go to bench directory
cd ~/frappe-bench
- Uninstall plugin from a specific site
bench --site [sitename] uninstall-app frappe_better_select_control
- Remove plugin from bench
bench remove-app frappe_better_select_control
- Restart bench
bench restart
- Go to Customization > Customize Form
- Enter the form type/name (ex: 'User')
- Scroll down to the form fields area and edit the select fields you want
- In the options property of the fields, add a hashtag # before the option text to make it a group label
- To close a group just add a single hashtag # in a new line
- Options:
One
Two
#Three
Four
Five
- Result HTML:
<option value="One">One</option>
<option value="Two">Two</option>
<optgroup label="Three">
<option value="Four">Four</option>
<option value="Five">Five</option>
</optgroup>
- Options:
#One
Two
Three
#Four
Five
Six
- Result HTML:
<optgroup label="One">
<option value="Two">Two</option>
<option value="Three">Three</option>
</optgroup>
<optgroup label="Four">
<option value="Five">Five</option>
<option value="Six">Six</option>
</optgroup>
- Options:
One
Two
#Three
Four
Five
#
Six
- Result HTML:
<option value="One">One</option>
<option value="Two">Two</option>
<optgroup label="Three">
<option value="Four">Four</option>
<option value="Five">Five</option>
</optgroup>
<option value="Six">Six</option>
MIT