Untitled
unknown
plain_text
3 years ago
2.7 kB
6
Indexable
import { LightningElement,wire,track } from 'lwc';
import validateEmail from '@salesforce/apex/RegisterController.validateEmail';
import validatePhone from '@salesforce/apex/RegisterController.validatePhone';
import createData from '@salesforce/apex/RegisterController.createData';
import { NavigationMixin } from 'lightning/navigation';
export default class RegistrationComponent extends NavigationMixin(LightningElement) {
firstName;
lastName;
email;
phone;
conpassword
showError1 = false;
showError2 = false;
showError3 = false;
phonecheck;
emailcheck;
password = 'test@12343';
//test@12343
handleFname(event)
{
this.firstName = event.target.value;
}
handleLname(event)
{
this.lastName = event.target.value;
}
handleEmail(event)
{
this.email = event.target.value;
}
handlePhone(event)
{
this.phone = event.target.value;
}
handlePassword(event)
{
this.password = event.target.value;
}
handleConpassword(event)
{
this.conpassword = event.target.value;
if(this.conpassword != this.password)
{
this.showError3 = true;
}
else{
this.showError3 = false;
}
}
@wire(validateEmail,{inpEmail:'$email'})
validEmail(data,error)
{
this.emailcheck = data.data;
if(this.emailcheck)
{
if(!this.emailcheck.email)
{
this.showError2 = true;
}
else{
this.showError2 = false;
}
}
}
@wire(validatePhone,{inpPhone:'$phone'})
validPhone(data,error)
{
this.phonecheck = data.data;
if(this.phonecheck)
{
if(!this.phonecheck.phone)
{
this.showError1 = true;
}
else{
this.showError1 = false;
}
}
}
submitHandler()
{
createData({
firstName:this.firstName,
lastName:this.lastName,
email:this.email,
phone:this.phone,
password:this.password
});
console.log('press')
console.log(this.firstName);
console.log(this.list);
this[NavigationMixin.Navigate]({
type:'standard__webPage',
attributes: {
url: 'https://training202104--sverma.sandbox.my.site.com/s/login/'
}
});
}
}Editor is loading...