Validation

5 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€85.19
List Price:  €119.27
You save:  €34.08
£74.77
List Price:  £104.68
You save:  £29.91
CA$137.76
List Price:  CA$192.87
You save:  CA$55.11
A$150.31
List Price:  A$210.44
You save:  A$60.13
S$129.19
List Price:  S$180.88
You save:  S$51.68
HK$778.05
List Price:  HK$1,089.31
You save:  HK$311.25
CHF 79.75
List Price:  CHF 111.66
You save:  CHF 31.90
NOK kr1,013.63
List Price:  NOK kr1,419.13
You save:  NOK kr405.49
DKK kr636.11
List Price:  DKK kr890.58
You save:  DKK kr254.47
NZ$172.26
List Price:  NZ$241.17
You save:  NZ$68.91
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,200.05
List Price:  ৳17,080.55
You save:  ৳4,880.50
₹9,057.54
List Price:  ₹12,680.92
You save:  ₹3,623.38
RM409.68
List Price:  RM573.58
You save:  RM163.89
₦145,242.47
List Price:  ₦203,345.27
You save:  ₦58,102.80
₨27,977.78
List Price:  ₨39,170.01
You save:  ₨11,192.23
฿3,144.12
List Price:  ฿4,401.89
You save:  ฿1,257.77
₺4,269.18
List Price:  ₺5,977.02
You save:  ₺1,707.84
B$541.88
List Price:  B$758.66
You save:  B$216.77
R1,687.37
List Price:  R2,362.39
You save:  R675.01
Лв166.49
List Price:  Лв233.10
You save:  Лв66.60
₩147,476.25
List Price:  ₩206,472.65
You save:  ₩58,996.40
₪322.26
List Price:  ₪451.18
You save:  ₪128.91
₱5,910.90
List Price:  ₱8,275.50
You save:  ₱2,364.60
¥15,574.94
List Price:  ¥21,805.54
You save:  ¥6,230.60
MX$1,801.20
List Price:  MX$2,521.76
You save:  MX$720.55
QR363.83
List Price:  QR509.38
You save:  QR145.55
P1,322.75
List Price:  P1,851.91
You save:  P529.15
KSh12,873.43
List Price:  KSh18,023.31
You save:  KSh5,149.88
E£4,753.52
List Price:  E£6,655.12
You save:  E£1,901.60
ብር15,598.69
List Price:  ብር21,838.79
You save:  ብር6,240.10
Kz91,690.83
List Price:  Kz128,370.83
You save:  Kz36,680
CLP$91,015.89
List Price:  CLP$127,425.89
You save:  CLP$36,410
CN¥705.37
List Price:  CN¥987.55
You save:  CN¥282.18
RD$6,384.36
List Price:  RD$8,938.36
You save:  RD$2,554
DA12,968.10
List Price:  DA18,155.86
You save:  DA5,187.76
FJ$227.15
List Price:  FJ$318.02
You save:  FJ$90.87
Q764.64
List Price:  Q1,070.52
You save:  Q305.88
GY$20,885.90
List Price:  GY$29,241.10
You save:  GY$8,355.19
ISK kr12,638.73
List Price:  ISK kr17,694.73
You save:  ISK kr5,056
DH918.43
List Price:  DH1,285.85
You save:  DH367.41
L1,687.62
List Price:  L2,362.74
You save:  L675.11
ден5,239.35
List Price:  ден7,335.30
You save:  ден2,095.95
MOP$800.52
List Price:  MOP$1,120.76
You save:  MOP$320.24
N$1,684.29
List Price:  N$2,358.08
You save:  N$673.78
C$3,674.23
List Price:  C$5,144.07
You save:  C$1,469.83
रु14,445.11
List Price:  रु20,223.73
You save:  रु5,778.62
S/336.11
List Price:  S/470.57
You save:  S/134.45
K425.87
List Price:  K596.24
You save:  K170.36
SAR375.18
List Price:  SAR525.27
You save:  SAR150.08
ZK2,303.63
List Price:  ZK3,225.17
You save:  ZK921.54
L433.54
List Price:  L606.98
You save:  L173.43
Kč2,066.70
List Price:  Kč2,893.46
You save:  Kč826.76
Ft32,795.72
List Price:  Ft45,915.32
You save:  Ft13,119.60
SEK kr926.89
List Price:  SEK kr1,297.69
You save:  SEK kr370.79
ARS$144,060.59
List Price:  ARS$201,690.59
You save:  ARS$57,630
Bs689.81
List Price:  Bs965.76
You save:  Bs275.95
COP$380,209.72
List Price:  COP$532,308.82
You save:  COP$152,099.10
₡49,937.50
List Price:  ₡69,914.50
You save:  ₡19,977
L2,628.31
List Price:  L3,679.75
You save:  L1,051.43
₲670,577.05
List Price:  ₲938,834.69
You save:  ₲268,257.64
$U3,917.97
List Price:  $U5,485.31
You save:  $U1,567.34
zł360.46
List Price:  zł504.66
You save:  zł144.20
Already have an account? Log In

Transcript

Hello, in this video we are going to take a look at vanie datian. So just some basic form validation. So let's go to HTML. Let's create a form for starters. And in here will What should we have an input in here? I'm actually just gonna keep it simple one input.

You understand what we do we just want you to be able to type equals txt name to eat as well. The name you guys. We were messy. Oh yeah, so we got this little input right here. That's pretty darn cool one do we can get I'm putting in now. I'm actually gonna put I'm gonna go radical.

I'll have a deal with your activity. Also. Click me, click me. Click me. And I'm gonna have an ID wacky. I'm just gonna say on click on lick, lick in onClick we'll put that in.

Just put that. Keep it simple. It's a function as usual, to console log, make sure it is working. When we click it, Libya's broken. Okay. Now here, what we're going to do is we are going to say document dot docx and from here we are going to essentially access elements and we can literally do dot name.

User Name. User name dot value printing console log console dot log. Oh hello, checkmate cannot read value of undefined. Okay. username is not valid Okay, okay. Okay, so for the form I need to provide a name as well.

And foremost, they're almost they say, document dot get the epic form, then you get an element from it. Okay, say hello. We get Hello. So that's how you get it. And what we're going to do is we'll keep this printout in there honestly doesn't really matter. And I think what we'll do is create a variable for var one equals this and everything everywhere that we need it, we can just use this instead, it'd be a lot easier to here we'll have it in here.

And we'll check if it's empty. Then we'll say you know, you've been very naughty. So if it's, you know, nothing in it. Then we're gonna say console dot log. Isn't it if I put something in week we don't get that. We'll also do a nova checks the wrong one, and we want a minimum length of 10.

So dot length is next we'll say console dot log 10. Then else is over. Now, dot log and save it for reload. We get into them too. So if I just type in H e Ll all the foil character, we get Lem should be at least and as a W or data should be Dustin now fantastic before removed the day, nine Lam should be at least 10. That is validation, we can validate the contents on our page.

If you have any questions, feel free to call me a message. And as usual, I look forward to seeing you in the next JavaScript video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.