Thursday, January 19, 2017

Lab 9: Validation

This is lab 9 where we have to create a form using JavaScript Validation to validate whether the input is correct or not. First we have to create a form with a legend that states the title of this form. In this case, the legend is Your information. Within the form, it will have a first name, last name, age, day of birth, phone number, and email. The difficult part is to use JavaScript to make it work and make it validate whether if the input is correct using boolean and if/else statements.

First I wanted to make every box require to be answered. So I would use: 


 if(something.checkValidity() == false){
    document.getElementById("a").innerHTML = something.validationMessage;}

this will write a message out saying that the information needs to be entered. After I did that for each, I also make it say thank you when you enter the correct input to the box. This is all the basic validations for the names. For the age, I also added a maximum number to 130 and minimum of 0. If the user enters anything outside of this range, it will notify the user. Also if the user enters an age under 18, it will say that the user is a kid, if it's over 18 then it will say the the user is an adult. We all know that we use 2 "/"s while listed birthdays so most of the time. And that is the validation for the birthdays, it must include 2 "/"s. For the phone number, I gave it a validation of a minimum number of 1000000000 and a maximum of 99999999999, because phone numbers are always between 10-11 digits and this includes all numbers that are 10 to 11 digits. And last, for the e-mail, I made a validation to require the "@" symbol and the "." because an e-mail can not exist without these two symbols.

Interview Lesson with Michael Chow

Image result for navy suit red tie
One day, a representative from the Wood Tobe-Coburn School, Micheal Chow came to speak with the two CTE classes at the CCEC of our school. One of which is the Web Designg that I'm in. He taught us many interviewing lessons. But the first and most important thing is to be open minded. He first told us how we should dress. Wearing a blue navy suit, white shirt and a red tie for guys, just like our president-elect, Donald Trump. Guys also have to take care of their hair to look sharper. Girls should wear heels to their confidence. They should also tie their hair up to shoe their face and neck to show that they do not have tattoos. He said that employers might not like it and it might leave a bad impression on them.

He also taught us how to talk and how to use good body languages. He say we should not move around while we talk, and also don't say ''um'' all the time. He even randomly picked students to practice their self introduction and hand shake during the beginning of an interview. I'm surprised that most students don't even know how to shake hands properly. He said that er have to get ready while the employer is coming towards you, let them introduce themselves first so you know who they are. Give a nice and firm handshake and remain good eye contact, not look else where. And say your own name nice and slowly. Is was the part I messed up on while I was chosen. I don't know why but I feel awkward saying my own name while I was shaking his hand. I always feel weird saying my own name. And I was not looking at his eyes. But everything else is fine. I just need to improve on whatever I need to improve on.

Sunday, January 8, 2017

Project 1: JavaScript Calculator

      This our first project of this school year and it's by far the most difficult project we've ever completed in this class. The target of this project 1 is to create a calculator that can add, subtract, multiply, and subtract multiple numbers using HTML, CSS, and JavaScript. I knew how to create a simple calculator for calculating just two numbers but I didn't know how to have more than just two numbers. Most of us didn't know what to do in this project. Although there are a lot of resources online, it's quite complicated to understand in a small amount of time. I really wish I had the time to be able to fully understand all the code, but I didn't. In the HTML file, I used divisions and spans to create the calculator using the method taught by my teacher. In the CSS file, it was mostly inspire by the calculator from The Code Player (http://thecodeplayer.com/walkthrough/javascript-css3-calculator). 
I really like the modern design to it so I made a very similar looking CSS to it, but I did customize it to fit the colors of my theme, using mainly blue, white, and some red and orange. Then I changed the sizes to my liking. The JavaScript is where I did't fully understand, I followed the tutorial from The Code Player and typed accordingly to its code suing mostly if/else statements. But since I was very busy with other important things outside of the classroom resently, I didn't have the time to fully understand all the JavaScript needed to create a calculator. I'm quite disappointed by myself because I usually understand everything pretty quickly and complete the project better than I expected. But since I really want to understand what I didn't, I will redo the whole project and try my best to understand everything later on when I'm not as busy.

JavaScript Booleans

      A boolean value in JavaScript is either yes or no, it is one of the two opposing values. It can also be on/off, true/false, and more. Strings or any number except for zero or equation that are correct is true. Basically, anything that is real retures true, and anything not real will reture false.Here some exercise about Boolean conditions from W3schools:

Exercise 1:

Exercise 2:

Exercise 3:

Exercise 4:

Exercise 5:


Exercise 6:



As you can see, typing "John" will reture a true boolean that writes the string "Hello John!".

And not typing "John" will reture a false boolean that writes "You are not John!".