Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49387

Can not get form value from html

$
0
0

@thetalkingtree wrote:

I tried to use a form to validate my inputs, I got it working for my signup page but in edit profile page I just can’t get the form value from HTML page. I can’t figure out why since the same code worked on another page.

  <form [formGroup] = "editProfileForm" novalidate>
    <ion-item>
      <ion-input type="text" placeholder = "First Name"   fromControlName = "firstName"></ion-input>
      <ion-input type="text" placeholder = "Last name" fromControlName = "lastName"></ion-input>
      <ion-icon name="person" item-start></ion-icon>
    </ion-item>
    <ion-col>
      <button ion-button class="update-button" (click)="update(editProfileForm.value)" >Save</button>
    </ion-col>
  </form>
constructor(
    private AFcurUser: AngularFireAuth,
    private AFdatabase: AngularFireDatabase,
    public loadingCtrl: LoadingController,
    public alertCtrl: AlertController,
    public app: App,
    public navCtrl: NavController,
    public firebaseModule : FirebaseProvider,
    public formBuilder : FormBuilder)
  {

    this.editProfileForm = formBuilder.group({
      email : ['',Validators.required],
      lastName : ['',Validators.required],
      firstName :  ['',Validators.required],
      phone : ['',Validators.required,],
      Introduction : ['',Validators.required,],
      travelRadius : ['',Validators.required,],
    });
}

  update = function()
  {
       console.log(this.editProfileForm.value);   //this display the pre configure value in constructor always.
}

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49387

Trending Articles