Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Chris Harders
Chris Harders
6,166 Points

How to pre-fill a form with URL parameters in JS?

I am not sure where to find this solution in the lessons...

I am setting up an orderform and would like to grab parameters in a URL and pre-fill hidden form values that are then added to the order.

I am lost with how to have the value in the URL pass to a form field. Can someone help me with this? Or suggest which lesson I should be searching in for this?

I am in the front-end developer track but scanning through the upcoming lessons, nothing stands out as the solution to this.

1 Answer

Steven Parker
Steven Parker
216,135 Points

It's not clear to me if you're describing s server-side or client-side task. Is there an existing website that does what you have in mind you could use as an example?