Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

checkbox: ngTrueValue/ngFalseValue not working properly with ngRequired #4970

Closed
iwyg opened this issue Nov 15, 2013 · 8 comments
Closed

checkbox: ngTrueValue/ngFalseValue not working properly with ngRequired #4970

iwyg opened this issue Nov 15, 2013 · 8 comments

Comments

@iwyg
Copy link

iwyg commented Nov 15, 2013

Actually doesn't work at all. Please see: http://jsfiddle.net/cHCdu/11/

@ghost ghost assigned tbosch Jan 7, 2014
@tbosch
Copy link
Contributor

tbosch commented Jan 7, 2014

Nice catch!

@caitp
Copy link
Contributor

caitp commented Jan 7, 2014

http://jsfiddle.net/cHCdu/18/ might be a slightly clearer reproduction. A fix should be pretty simple for this, but might hurt performance.

I think I've mentioned elsewhere that there can be variations on the semantic meaning of a "required" checkbox, it doesn't necessarily always mean that it is required to be "checked" (for instance, in some cases, an indeterminate checkbox value might not be considered to be an entered value, and should not get past required field validation).

So this problem can get a bit more complicated, but maybe a short term fix would be just to add a call to equals(ctrl.$modelValue, value) or something. I think I actually have a PR somewhere which does this, for a different reason though. Let me see if I can dig it up and reference this.

@caitp
Copy link
Contributor

caitp commented Jan 7, 2014

Actually, a call to equals() is only needed for that PR because it possibly deals with objects, so the current test should already work. But IIRC it has been tested to make sure ngRequired works correctly. It wouldn't hurt to try it again.

Since it's kind of a breaking change with all of the review comments addressed, it's unlikely to be merged in time for 1.2.8 though.

@kencaron
Copy link

+1. Would love to see this make it's way in some form of 1.2.x as it looks like I will not be able to drop IE8 in the near future.

@caitp
Copy link
Contributor

caitp commented Jul 31, 2014

the implementation is a feature so we can't add it to 1.2.x, but it's a pretty trivial feature so you could apply it to v1.2.x manually, for sure

@kencaron
Copy link

Thanks for the prompt reply, and thanks, I am currently going with a manual workaround.

@btford btford removed the gh: issue label Aug 20, 2014
@Narretz
Copy link
Contributor

Narretz commented Sep 11, 2014

This has been fixed in master: 3e51b84

@Narretz Narretz closed this as completed Sep 11, 2014
@vipinrvbridge
Copy link

            <span ng-repeat="leaveStatus in usersleaveList.leaveStatus" title="{{leaveStatus.status_name}}"> {{leaveStatus.status_name}}  <i class="crud_icon fa" aria-hidden="true" ><input id="{{leaveStatus.status_name}}"   class="ng-pristine ng-valid ng-touched checkBoxes"   ng-click="usersleaveList.clickThis(leaveStatus.status_name)"  type="checkbox" value="{{leaveStatus.id}}"></i></span>

This is my dynamic generated Check box list. In this check box list we click on any one, it display checked. But actually its attribute "checked" is none. var ch =$(checkbox).attr('checked'); return ch = "Undefined"
How to fix it?

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

No branches or pull requests

7 participants