<div class="col-md-3 reg-field-input">
<eg-date-input
ng-required="field_required('au', 'dob')"
- ng-model="patron.dob"
- ng-blur="handle_field_changed(patron, 'dob')">
+ ng-model="patron.dob">
</eg-date-input>
</div>
<div class="col-md-6 patron-reg-example">
[% draw_field_label('au', 'expire_date') %]
<div class="col-md-3 reg-field-input">
<eg-date-input
- ng-blur="handle_field_changed(patron, 'expire_date')"
ng-model="patron.expire_date">
</eg-date-input>
</div>
prs.set_field_patterns(field_patterns);
apply_username_regex();
+
+ add_date_watchers();
});
+ function add_date_watchers() {
+
+ $scope.$watch('patron.dob', function(newVal, oldVal) {
+ // Even though this runs after page data load, there
+ // are still times when it fires unnecessarily.
+ if (newVal === oldVal) return;
+
+ console.debug('dob change: ' + newVal + ' : ' + oldVal);
+ maintain_juvenile_flag();
+ });
+
+ // No need to watch expire_date
+ }
+
// update the currently displayed field documentation
$scope.set_selected_field_doc = function(cls, field) {
var cls = obj.classname; // set by egIdl
var value = obj[field_name];
- console.log('changing field ' + field_name + ' to ' + value);
+ console.debug('changing field ' + field_name + ' to ' + value);
switch (field_name) {
case 'day_phone' :
$scope.barcode_changed(value);
apply_username_regex();
break;
-
- case 'dob':
- maintain_juvenile_flag();
- break;
}
}