1

I have some models being updated from a look-up. It is the 1st line that's not updating (but the other models are updated correctly). I tried wrapping it in an $apply but that made matters worse:

 function mapRequestorToForm() { //PrimaryCtyhocnOrInnCode binding not updating //$scope.$apply(function() { dmpe.form.PrimaryCtyhocnOrInnCode = dmpe.requestor.primaryInnCode; dmpe.form.hotelName = dmpe.requestor.hotelName; dmpe.form.requestor = dmpe.requestor; //}); } 

Here's the input element. Funny thing, the pre element is displaying the correct value.

 <label for="primaryCtyhocn">Primary Inn Code/ CTYHOCN</label> <input type="text" id="primaryCtyhocn" name="primaryCtyhocn" ng-model="dmpe.form.PrimaryCtyhocnOrInnCode" class="form-control required disabled-bg" disabled placeholder="Primary Inn Code/ Ctyhocn" ng-minlength="5" ng-maxlength="7" required /> <pre>PrimaryCtyhocnOrInnCode: {{dmpe.form.PrimaryCtyhocnOrInnCode}}</pre> 

this one is updated correctly (line 2 of the map method, using the same source object with similar disabled attributes:

 <div class="col-md-4"> <label for="hotelName">Hotel Name</label> <input type="text" id="hotelName" name="hotelName" ng-model="dmpe.form.hotelName" class="form-control required disabled-bg" disabled placeholder="Hotel Name required" required /> </div> 
6
  • What's up with the disabled attribute? It feels like your code may have some JavaScript executing behind the scenes that's trying to set the value of that input text box and it's failing because of that attribute. Commented Jun 18, 2015 at 17:18
  • Just a silly guess..did you missed here dmpe.requestor.primaryInnCode should be dmpe.requestor.primaryCtyhocnOrInnCode & are you sure,if it is primaryInnCode. does contain value? Commented Jun 18, 2015 at 17:21
  • @MichaelPerrenoud fields are populated for the user based on an object returned from a look-up. For this use-case it is not editable but can be given the correct role. The other disabled input fields are updating correctly Commented Jun 18, 2015 at 17:41
  • @pankajparkar thanks but that is the proper field. It is an object returned from a look-up. The pre element is displaying the correct value so the model has the value but the binding isn't working Commented Jun 18, 2015 at 17:43
  • Is it possible that the value you're displaying does not meet the minimum length requirement? Commented Jun 18, 2015 at 18:41

1 Answer 1

1

In case someone else runs into this and their brain is failing them as mine did. It was an issue with the incoming data, it failed the max length constraint. Thanks to Michael Perrenoud!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.