← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Reviewed:  https://review.openstack.org/555096
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=f8196331ea139f52b303eb87d0280152f06d9475
Submitter: Zuul
Branch:    master

commit f8196331ea139f52b303eb87d0280152f06d9475
Author: Akihiro Motoki <amotoki@xxxxxxxxx>
Date:   Thu Mar 22 08:32:00 2018 +0900

    Add asterisk to conditionally required fields
    
    https://review.openstack.org/#/c/552247/ introduced a way to
    add asterisk mark to conditionally required fields.
    
    This commit covers several known forms:
    - Create Network / Create Subnet
    - Create Port
    - Attach Interface to Instance
    - Add Security Group Rule
    
    Change-Id: I809c23fd64dc2f379c3fdb585741c6b266ec5b1b
    Closes-Bug: #1420370
    Closes-Bug: #1292165
    Closes-Bug: #1755131


** Changed in: horizon
       Status: In Progress => Fix Released

-- 
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):
  Fix Released

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


References