Skip to content

pfModalOverlay: no way to close modal for custom validations #755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
a2batic opened this issue Aug 8, 2018 · 4 comments · Fixed by #756
Closed

pfModalOverlay: no way to close modal for custom validations #755

a2batic opened this issue Aug 8, 2018 · 4 comments · Fixed by #756
Assignees

Comments

@a2batic
Copy link

a2batic commented Aug 8, 2018

If modal has a form and form validation depends on API response, the modal closes itself without waiting for API response and show error. There seems to be no way to stop closing of modal.

@gnehapk
Copy link

gnehapk commented Aug 9, 2018

Also I am not able to access form controls in order to validate and provide error messages accordingly. For eg. I am using ng-maxlength which sets the flag {formname}{fieldname}.$error.maxlength to false but I don't see a way to access it inside the pfModalOverlay component.

@dtaylor113 dtaylor113 self-assigned this Aug 9, 2018
@dtaylor113
Copy link
Member

Hi @gnehapk, I updated the ngDoc example pfModalOveral to show maxLength errors:
image
Here is the relevant HTML in `demo-form.html':

<input type="text" name="fieldTwo" id="textInput2" class="form-control" 
       ng-model="$ctrl.modalBodyScope.inputs.second"
       ng-maxlength="$ctrl.modalBodyScope.maxLength" />

*Note: added $scope.formScope.maxLength = 6; $scope.formScope is used for $ctrl.modalBodyScope when passed into the pfModalOverlay component. I also added a name attribute to the input field.

Here is the error validation message:

  <div ng-if="demoForm.fieldTwo.$dirty && demoForm.fieldTwo.$touched">
       <div class="has-error" ng-if="demoForm.fieldTwo.$error.maxlength">
         <span class="help-block">
           Field Two exceeds max length of {{$ctrl.modalBodyScope.maxLength}}!
         </span>
       </div>
    </div>

Where demoForm is already defined as <form name='demoForm'...

@dtaylor113
Copy link
Member

For Tendrl (Gluster Management UI) and Ceph-dashboard

@dtaylor113
Copy link
Member

The fix/enhancement for this Issue is available in angular-patternfly v4.18.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants