Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Radio button required field validation not working #181

Closed
PrashantP25 opened this issue Apr 14, 2019 · 3 comments
Closed

Radio button required field validation not working #181

PrashantP25 opened this issue Apr 14, 2019 · 3 comments

Comments

@PrashantP25
Copy link
Contributor

Hi,
While working on a use-case where we need required field validation on radio button, we encountered that, when we add validation via code i.e using object.addValidator, on blur, validation message is not getting populated in error span. Where as when we use attribute validation it just works fine. In our use-case we use ghiscoding method to add validation for which radio buttons required field validation is not working. After investigating this issue we found a fix in "Validation-Service.js" file.
I have created plunker ( Click Here )
It has all required files and 2 versions of your JS file.
ghiscodingwithfix has the fix. Please try changing references in index.html.
The fix that was done in file Validation-service.js are:

  • on line number 109, we need to replace var validationPromise = attemptToValidate(self, event.target.value, 0); line with var validationPromise = attemptToValidate(self, (attrs.ctrl.$modelValue == undefined ? '' : attrs.ctrl.$modelValue),0);

  • on line number 577 we need to replace var validationPromise = attemptToValidate(self, event.target.value, 10); line with var validationPromise = attemptToValidate(self, (attrs.ctrl.$modelValue == undefined ? '' : attrs.ctrl.$modelValue),10);

Can you please accommodate these changes in repo?
If you are ok, I will create a PR and let you know for approval

Thanks,
Prashant

@PrashantP25
Copy link
Contributor Author

I have done the change and raised a PR. Can you check and see if you can accept this change?
PR - 181

@ghiscoding
Copy link
Owner

Ok I have pushed a new version 1.5.27 on NPM only. I assume that we can close this issue then

@PrashantP25
Copy link
Contributor Author

Thank you so much for the help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants