title: emberjs field validation regex
body: <p>i have a custom emberjs field like this</p>
  
  <pre><code>App.NameTextField = App.FieldView.extend({
  ValidationText: '',
  IsValid: function(){
      var valText = this.get('ValidationText');
      return valText == '';
  }.property(),
  Regex: null,
  DataView: Ember.TextField.extend({
      nameValue: function(){
          return App.FormContact.get('FirstName');
      }.property(),
      ValidationMessages: {Req: 'this is required. fill it in.', Invalid: 'invalid name', Valid: ''},
      valueBinding: 'nameValue',
      Regex: function(){
          return this.get('parentView').get('Regex');
      }.property(),
      IsRequired: function(){
          return this.get('parentView').get('IsRequired');
      }.property(),
      focusOut: function(){
          var reg = new RegExp(this.get('Regex'));
          var val = this.get('value');
          var validMsg = validateName(this.get('IsRequired'), val, reg);
          this.get('parentView').set('ValidationText', this.ValidationMessages[validMsg]);
      }
  })
  </code></pre>
  
  <p>});</p>
  
  <p>in the front end, i'm assigning the regex like this:</p>
  
  <pre><code> &lt;p&gt;{{view Rewards.NameTextField size="50px" label="First Name" Regex="/^[A-Za-z-'.\s]+$/"}}&lt;/p&gt;
  </code></pre>
  
  <p>it's a problem because when i do "this.get('Regex')" in DataView, it evaluates to </p>
  
  <blockquote>
    <p>//^[A-Za-z-'.\s]+$//</p>
  </blockquote>
  
  <p>causing my Regex to evaluate incorrectly. so how do i dynamically assign a Regex value to a view in the template?</p>
  
  <p>thanks in advanced!</p>