Video instructions and help with filling out and completing Why Form 8815 Verification

Instructions and Help about Why Form 8815 Verification

Hi this is Ralph and in this video I want to expand a little bit on the check for blank function that I just did a little bit ago in the previous video so in my last video we have a simple form we just load this up on our yield web page here so I had a simple form first name and last name and when the user tried to submit the form it would check to see if the first name field was blank and if it was it would give him an alert and it would color the border of that box red okay I'm just going to read for element it's tops the form so let me just kind of refresh that head back over to my editor so that simply checks for the value of the first name box but now I want to check for the values of both boxes to see if either of them are blank so what I'm going to do this time is I'm going to expand on my existing function so I'm going to go ahead and start off with in my check for blank function I'm going to declare a variable this variable is going to be called error message and it's going to be equal to nothing it's going to be equal to empty so there is no error message at the beginning then we're going to go through our function here the variable message starts with nothing if the first name field is blank then what I'm going to do instead of just providing an alert here I'm going to append so that means I'm going to do a plus equals count plus I'm sorry I'm going to do an error message plus equals and then I'll simply put in something like enter your first name and I'm also going to do a backslash in which is going to give me a line break okay so if the first name field is blank then my error message is going to be appended remember my error message started off with nothing so if they left the first name field blank my error message is now going to have into your first name in there I'm still going to color the border of that particular box red I'm going to take return false out for now okay so this is just checking for the first name box pretty easy I'm going to select this entire if statement copy it and paste so now I have duplicates and I'm going to change this over to last name enter your last name and then L name and if you recall from that other tutorial fname and lname are simply the IDS of my two text boxes okay so the function is now my variable error message is blank but if the first name field is empty or blank then it's going to append my error message then the next statement is going to check for last name if my last name is blank then it's going to append my error message again so those two if statements are done then I'm going to create another if statement it's my third if statement in the function and I'm just can do a paste here if my error message is not equal to empty okay think about this for a moment my error message started off as being empty if the person didn't make any missed it make any mistakes then my error message will still be empty and if my error message is still empty everything's fine but if they made some mistakes and my error message is going to have some content so if my error message is not empty meaning it has content then I'm going to display an alert and my alert is simply going to be my error message whatever that happens to be I'm going to send an alert of my error message and I've already got a type of their error message there we go and instead of course this border color I'm going to have return false which means my form will get stopped in its tracks so let's see what we have now I've got a function for check for blank I'm declaring a variable called error message and that error message is empty I'm going to check my first name field if my first name field is empty I'm going to append my error message and I'm going to color the border of that text box red then I'm going to check for the last name field if the last name field is empty I'm going to append my error message and I'm going to check or I'm going to make the border of that text box red and then I'm going to see if my error message has anything if my error message has something in it meaning it's not empty then I'm going to provide an alert and I'm going to stop the form well what if everything is fine well if everything is fine then nothing will happen related to my first name box nothing will happen related to my last name box my error message will still be empty which means nothing will get triggered here in the form gets submitted just fine so let me save this I didn't have to make any changes by the way to my form I just modified my my function of it so now I can head back over to my browser see make sure I'm all refreshed here and I'm just going to hit send data enter your first name enter your last name okay and they're both red alright well what if I have one of them empty Ralph and then I'll click send data up into your last name and that box is red refresh what if I just enter a last name I can spell my