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
€84.80
List Price:  €118.72
You save:  €33.92
£73.15
List Price:  £102.41
You save:  £29.26
CA$136.68
List Price:  CA$191.36
You save:  CA$54.67
A$143
List Price:  A$200.20
You save:  A$57.20
S$127.14
List Price:  S$178
You save:  S$50.86
HK$781.15
List Price:  HK$1,093.65
You save:  HK$312.49
CHF 77.69
List Price:  CHF 108.77
You save:  CHF 31.08
NOK kr967.15
List Price:  NOK kr1,354.05
You save:  NOK kr386.90
DKK kr633.35
List Price:  DKK kr886.72
You save:  DKK kr253.36
NZ$165.87
List Price:  NZ$232.22
You save:  NZ$66.35
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,214.06
List Price:  ৳17,100.18
You save:  ৳4,886.11
₹9,025.73
List Price:  ₹12,636.38
You save:  ₹3,610.65
RM393.21
List Price:  RM550.51
You save:  RM157.30
₦138,728.12
List Price:  ₦194,224.92
You save:  ₦55,496.80
₨27,951.71
List Price:  ₨39,133.51
You save:  ₨11,181.80
฿3,156.95
List Price:  ฿4,419.85
You save:  ฿1,262.90
₺4,348.14
List Price:  ₺6,087.57
You save:  ₺1,739.43
B$522.81
List Price:  B$731.96
You save:  B$209.14
R1,598.76
List Price:  R2,238.33
You save:  R639.57
Лв165.80
List Price:  Лв232.13
You save:  Лв66.32
₩144,844.20
List Price:  ₩202,787.68
You save:  ₩57,943.47
₪308.99
List Price:  ₪432.60
You save:  ₪123.60
₱5,910
List Price:  ₱8,274.24
You save:  ₱2,364.23
¥15,584.92
List Price:  ¥21,819.52
You save:  ¥6,234.59
MX$1,730.78
List Price:  MX$2,423.16
You save:  MX$692.38
QR363.42
List Price:  QR508.80
You save:  QR145.38
P1,322.22
List Price:  P1,851.16
You save:  P528.94
KSh12,898.71
List Price:  KSh18,058.71
You save:  KSh5,160
E£4,694.52
List Price:  E£6,572.51
You save:  E£1,877.99
ብር15,502.71
List Price:  ብር21,704.42
You save:  ብር6,201.70
Kz91,219.87
List Price:  Kz127,711.47
You save:  Kz36,491.60
CLP$86,330.36
List Price:  CLP$120,865.96
You save:  CLP$34,535.60
CN¥693.70
List Price:  CN¥971.20
You save:  CN¥277.50
RD$6,347.79
List Price:  RD$8,887.16
You save:  RD$2,539.37
DA12,995.80
List Price:  DA18,194.64
You save:  DA5,198.84
FJ$220.10
List Price:  FJ$308.15
You save:  FJ$88.05
Q766.59
List Price:  Q1,073.25
You save:  Q306.66
GY$20,909.94
List Price:  GY$29,274.76
You save:  GY$8,364.81
ISK kr12,296.77
List Price:  ISK kr17,215.97
You save:  ISK kr4,919.20
DH916.77
List Price:  DH1,283.52
You save:  DH366.74
L1,682.77
List Price:  L2,355.95
You save:  L673.17
ден5,226.90
List Price:  ден7,317.88
You save:  ден2,090.97
MOP$804.27
List Price:  MOP$1,126.01
You save:  MOP$321.74
N$1,600.79
List Price:  N$2,241.17
You save:  N$640.38
C$3,678.21
List Price:  C$5,149.64
You save:  C$1,471.43
रु14,704.79
List Price:  रु20,587.29
You save:  रु5,882.50
S/336.45
List Price:  S/471.05
You save:  S/134.59
K428.19
List Price:  K599.48
You save:  K171.29
SAR374.94
List Price:  SAR524.94
You save:  SAR149.99
ZK1,961.36
List Price:  ZK2,745.98
You save:  ZK784.62
L432.04
List Price:  L604.88
You save:  L172.83
Kč2,062.86
List Price:  Kč2,888.09
You save:  Kč825.23
Ft32,289.72
List Price:  Ft45,206.90
You save:  Ft12,917.18
SEK kr892.23
List Price:  SEK kr1,249.16
You save:  SEK kr356.92
ARS$144,835.52
List Price:  ARS$202,775.52
You save:  ARS$57,940
Bs696.40
List Price:  Bs975
You save:  Bs278.59
COP$362,990.69
List Price:  COP$508,201.49
You save:  COP$145,210.80
₡49,635.87
List Price:  ₡69,492.20
You save:  ₡19,856.33
L2,640.54
List Price:  L3,696.86
You save:  L1,056.32
₲663,066.42
List Price:  ₲928,319.51
You save:  ₲265,253.09
$U3,854.56
List Price:  $U5,396.54
You save:  $U1,541.97
zł357.81
List Price:  zł500.96
You save:  zł143.14
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.