Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ng-dirty class for a control that was not touched
Message
De
08/03/2015 05:22:32
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01616375
Message ID:
01616433
Vues:
21
>>>Hi everybody,
>>>
>>>I am seeing a strange behavior in one of our forms. Basically, after we just open a form to view and then try to navigate to another row, we're getting a message about unsaved changes. I identified the problematic control and inspecting the element returns
>>>
>>><data-sm:date-time-picker ng-model="currentLiabilityForm.expDate" is-date-range="false" 
>>>form="form.editLiabilityForm" name="expDate" ng-show="currentLiabilityForm.expStatic" 
>>>ng-required="currentLiabilityForm.expStatic" 
>>>class="ng-untouched ng-valid ng-isolate-scope ng-valid-required ng-dirty ng-valid-parse ng-valid-daterange" required="required">
>>><div class="input-group">
>>>    <input type="text" autocomplete="off" id="expDate" name="expDate" class="form-control ng-valid" placeholder="">
>>>    <span class="input-group-addon datepickerbutton">
>>>        <!--datepickerbutton:jquery datetimepicker plugin requires this class-->
>>>        <i class="fa fa-calendar"></i>
>>>    </span>
>>>    <!-- ngIf: showBod -->
>>>    <!-- ngIf: showEod -->
>>>    <!-- ngIf: showNow -->
>>></div>
>>><div class="field-validation-error">
>>>    <span ng-show="!validStartDateRange()" class="ng-hide">Start date must begin before end date.</span>
>>>    <span ng-show="!validEndDateRange()" class="ng-hide">End date must begin after start date.</span>
>>>    <span ng-show="!validRequired()" class="ng-hide">Date is required.</span>
>>>    <span ng-show="!validFutureDate()" class="ng-hide">Date must be in the future.</span>
>>>    <span ng-show="!validPastDate()" class="ng-hide">Date must be in the past.</span>
>>></div></data-sm:date-time-picker>
>>>
>>>
>>>Note ng-dirty class among other classes. What may cause this weird behavior, do you know?
>>>
>>>This is that control in HTML markup:
>>>
>>>
>>><div class="form-group" ng-show="currentLiabilityForm.expStatic">
>>>            <label class="control-label col-md-3 col-lg-3">@Labels.expirationDate: </label>
>>>            <div class="col-lg-4">
>>>                <data-sm:date-time-picker ng-model="currentLiabilityForm.expDate"
>>>                                          is-date-range="false"
>>>                                          form="form.editLiabilityForm"
>>>                                          
>>>                                          name="expDate"
>>>                                          ng-show="currentLiabilityForm.expStatic"
>>>                                          ng-required="currentLiabilityForm.expStatic">
>>>                </data-sm:date-time-picker>
>>>            </div>
>>>            <div class="field-validation-error">
>>>                <span ng-show="form.editLiabilityForm.expDate.$error.required 
>>>                      && form.editLiabilityForm.expDate.$dirty">@String.Format(Messages.isRequired, Labels.expirationDate)</span>
>>>            </div>
>>>        </div>
>>>
>>>Thanks in advance.
>>
>>Nothing weird. You're flagging it as ditry in the markup so what do you expect......
>
>What do you mean here? What am I flagging dirty in markup?

Sorry, misread.
I see the form is dirty at debug time but are any of the elements (controls) dirty as well? If so you at least know which control is causing the problem. If none are dirty then I'd suspect the timepicker. If you can't prevent the problem then, if you can identify when it happens, you can use $setPristine() on the form to clear it.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform