1

I have a client supplied Saleforce form that has a generated name value on the state selector in the form. Angular is throwing a parse error when run.

I'm guessing it doesn't like the name, though I can't figure out how to get it to accept it.

I can't change the name property since it is tied to the client's Salesforce app.

Any suggestions? It's the "00N6100000GrRGn" that is causing the error.

<div class="form-group">
    <label for="00N6100000GrRGn">State <sup><span class="required">*</span</sup></label>
    <select id="00N6100000GrRGn" name="00N6100000GrRGn" title="State" class="form-control" ng-model="user.00N6100000GrRGn" ng-required="true">
        <option value="">Select your state</option>
        <option value="AL">Alabama</option>
        <option value="AK">Alaska</option>
    </select>
    <p class="error validationerror" ng-show="myform.00N6100000GrRGn.$invalid && myform.00N6100000GrRGn.$touched">You must choose your state.</p>
</div>

1 Answer 1

1

Since user.00N6100000GrRGn is not a valid identifier for object property, you need to use bracket notation:

ng-model="user['00N6100000GrRGn']"

and

ng-show="myform['00N6100000GrRGn'].$invalid && myform['00N6100000GrRGn'].$touched"
Sign up to request clarification or add additional context in comments.

1 Comment

Awesome, that did it. I didn't notice that the "." was removed too. Thanks a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.