Skip to content

Commit

Permalink
forms: Add ability to disable ChoiceField fields
Browse files Browse the repository at this point in the history
  • Loading branch information
protich committed Sep 2, 2022
1 parent 681bea0 commit bc15443
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/class.forms.php
Expand Up @@ -1862,7 +1862,10 @@ function getConfigurationOptions() {
'id'=>1, 'label'=>__('Choices'), 'required'=>false, 'default'=>'',
'hint'=>__('List choices, one per line. To protect against spelling changes, specify key:value names to preserve entries if the list item names change.</br><b>Note:</b> If you have more than two choices, use a List instead.'),
'validator'=>'choices',
'configuration'=>array('html'=>false)
'configuration'=>array(
'html' => false,
'disabled' => false,
)
)),
'default' => new TextboxField(array(
'id'=>3, 'label'=>__('Default'), 'required'=>false, 'default'=>'',
Expand Down Expand Up @@ -4646,6 +4649,8 @@ function render($options=array()) {
echo ' data-'.$D.'="'.Format::htmlchars($V).'"';
?>
data-placeholder="<?php echo Format::htmlchars($prompt); ?>"
<?php if ($config['disabled'])
echo ' disabled="disabled"'; ?>
<?php if ($config['multiselect'])
echo ' multiple="multiple"'; ?>>
<?php if ($showdefault || (!$have_def && !$config['multiselect'])) { ?>
Expand Down

0 comments on commit bc15443

Please sign in to comment.