Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now the web is great because it allows me to communicate to the world, to get my message out there, but what if people need to contact me? Well, it is a two-way medium. Yhat's why I have the contact page open, because what I need to do here is go beyond just a link. So this actually will link out to this email address, but it launches the default email client, whatever they have on their machine. But what I want to implement is a form field--in fact, basically the ability to fill out a form and send me a message. Name, email, and the message, as well the Submit button.
So I'm going to close Safari, I'm going to go into my contact page, and then I'm going to delete those lines, just like that. And I'm going to go to the Insert panel, and I'm going to change that to Forms, okay. So that's what I have up. And I need to implement a Name field. That's going to be a text field. Well, there is actually a couple in here. And notice right up here near the top there's this Text Field, but as I scroll down I want to use this Spry Validation Text Field because this has additional functionality I could take advantage of.
So with my cursor right there, I can select Spry Validation Text Field, and I can go ahead and give it an ID. And in this case, it's going to be, you guessed it, Name. I'm going to leave everything else as is. Okay, you don't need to worry about any of that. You don't even need to worry about the label because I'm going to show you what you can do with the label. So, selecting OK, this is a message you'll get. It says, hey, do you want to add a form tag? And a form tag is just a tag that will encompass all of the different form fields and allow you to submit all of that information to wherever you want to send it.
So you do want to say yes here. And that form field is actually this red line. But this is my Spry Text Field that I've added. So I can select it. Now, the first thing I'm going to do is change the name of it. It says Spry Text Field over here. I'm going to get rid of that one, and I'm just going to call this--in fact I'm going to name this the nameTextField, okay, just like that. With that selected, I can take a look at all these different options I have because it's a Spry Validation Text Field.
So again, right down here I can add a hint, and this will be your name. As I enter that in, that's actually what will appear right in here. And I can always check that by clicking Live view. So there you can see that's exactly what I want, nice and efficient. I can have a minimum number of characters, a maximum number of characters, if I want to as well, but this is what I like. This Preview states is going to be required information. In fact, on Blur, so when you deselect it, I want it to say, hey you know what, a value is required, because you have to enter in your name if you want to be contacted back.
That's the whole idea, allow them to enter in their name and make it required, and that's what we need to do. I'm going to place my cursor over here and just hit Enter, because for my next field I'm going to add a Spry Validation Text Field. And in this case it's going to be email. That's the ID. I'm going to leave everything else alone. Nice and easy. Selecting that, changing this to emailTextField, like that. And as I select it I can give it a hint, Your Email--not your friend's email but your email.
And required on Blur, this is a required item as well. In this case, in the case of an email, I want to make sure they submit a valid email, so I'm going to change the Type to Email Address, okay. So that's going to recognize whether they have @ symbol and a period. Next up, hitting Return after I put my cursor on the end here, and now I need to implement a text area, okay. So selecting that, the ID is going to be message, selecting OK. Scrolling down, you can see it right here, and I want this to be a messageTextArea.
All right, so selecting that, I can take a look, and I can say hey you know what, minimum number of characters is one, maximum number of characters maybe like 500. Okay, not too many, but about 500. I don't need to get a long book delivered through this emailTextField. Nonetheless what I can do is I can include a counter, which I really like. I can say since I'm requiring a minimum of one but really a maximum of 500, I can say you know, what counts the characters remaining.
So I'll show you what that looks like. As far as validation, I want to validate it on Blur, just like I've been doing. I'd say that looks good. Even the hint might be Your Message. With all of that in place, in fact, I'm going to save this page now, and look what gets added, all these dependent files for text fields, text areas. That's good. Clicking Live view, you can see as I scroll down how this is set up. So I can type in your name, so right there. Well, let's click off to Your Email, so I'm actually going to come mess this up.
I'm going to do the @ sign but I'm not going to put a period, and as I defocus it, or blur it, it says hey you know what, this is an invalid format. So I'll type in the correct one and blur it, which means you know defocus that, and you can see that they're green, green means go. Right in here, I love your site, a couple of exclamation points. As I do that, you can see that character count right down here, change. Hey, why not add a couple extra exclamation points. I can click off of that as well.
This looks good. The last thing I'm going to do is I'm going to go ahead and add a Submit button. So I'm going to turn off Live view and just after that last element of that text area, I'm going to add a button. So right here I'm going to insert a button. ID again is going to be Submit. Select that, type that in. There is my Submit button. I can see, overall, everything looks pretty good. I like how this looks. It's actually going to work pretty well. And really, the next step with this form is to go ahead and actually implement the functionality, when you hit Submit, have it submit the data and even go to a Thank You page.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.