← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1755131] [NEW] Form fields with 'switched' can't be set required=True

 

Public bug reported:

Some form fields like class AttachInterface in
dashboards/project/instances/forms.py:

class AttachInterface(forms.SelfHandlingForm):
    specification_method = forms.ThemableChoiceField(
        label=_("The way to specify an interface"),
        initial=False,
        widget=forms.ThemableSelectWidget(attrs={
            'class': 'switchable',
            'data-slug': 'specification_method',
        }))
    network = forms.ThemableChoiceField(
        label=_("Network"),
        required=False,
        widget=forms.ThemableSelectWidget(attrs={
            'class': 'switched',
            'data-switch-on': 'specification_method',
            'data-specification_method-network': _('Network'),
        }))

When the value of specification_method field is selected as network,the network filed is necessary and should
set required=True.But when the value is selected as port, the network field is not necessary and the network
field is also be checked and return an error.Now, we need the star when the network is necessary and ignore the
check when it is not necessary.

** Affects: horizon
     Importance: Undecided
     Assignee: Wangliangyu (wangly)
         Status: New

** Changed in: horizon
     Assignee: (unassigned) => Wangliangyu (wangly)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1755131

Title:
  Form fields with 'switched' can't be set required=True

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  Some form fields like class AttachInterface in
  dashboards/project/instances/forms.py:

  class AttachInterface(forms.SelfHandlingForm):
      specification_method = forms.ThemableChoiceField(
          label=_("The way to specify an interface"),
          initial=False,
          widget=forms.ThemableSelectWidget(attrs={
              'class': 'switchable',
              'data-slug': 'specification_method',
          }))
      network = forms.ThemableChoiceField(
          label=_("Network"),
          required=False,
          widget=forms.ThemableSelectWidget(attrs={
              'class': 'switched',
              'data-switch-on': 'specification_method',
              'data-specification_method-network': _('Network'),
          }))

  When the value of specification_method field is selected as network,the network filed is necessary and should
  set required=True.But when the value is selected as port, the network field is not necessary and the network
  field is also be checked and return an error.Now, we need the star when the network is necessary and ignore the
  check when it is not necessary.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1755131/+subscriptions


Follow ups