Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Form Submit without refresh?

Hey,

I need some help with a form. Whats the best way to submit a form without the page refreshing. My contact form is on a hidden div onload so the user cant really see the error messages without scrolling back down to the div. Am I going to have to do the whole thing using Ajaxs? Can anyone help?

http://codepad.viper-7.com/YmYY1t

Thanks you =)

2 Answers

I'm not 100% sure I understand the question.

You can use HTML5 input patterns or JQuery to show inline errors without the need to refresh the page.

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

As James mentioned, you can use JavaScript / jQuery to show inline errors. Andrew covers this in one of his stages: