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

Python

How to post NON fields value inside of form without a Form field

I have this code of HTML :

<div class="form-group form-group-default"> <label>Address ( <span id="latitude" class="label label-default">45.034795740291074</span> <span id="longitude" class="label label-default">-93.0786215470215</span> ) </label> <input type="text" name="address" id="address" placeholder="Enter CampGround Addres" autocomplete="off" class="form-control" required="" aria-required="true"> </div>

<span id="latitude" class="label label-default">45.034795740291074</span> <span id="longitude" class="label label-default">-93.0786215470215</span>

Where 45.034795740291074 and -93.0786215470215 are dynamic values generated via jQUERY Google API i want to get those and get posted to form

I'm using flask WTF forms.

How do i do that please tell me and give a good example of it.

1 Answer

If that content is being generated by JavaScript on the client side (i.e. in the user's browser after/during page load), then you'll need to use JavaScript/jQuery to get it.

You could then create a hidden form field and use JavaScript/jQuery to change the value of that field to match the content, then as long as that is part of the form, it should be sent along with everything else when it gets submitted.

If you paste in some of your code, we can probably help you further.

i got it sort by my self use Jquery, AJAX and learn some new cool stuff :) Thanks for your help Sir.

Great to hear you figured it out!

You should share the code that you used to solve your problem so that others can learn from it also.

Happy coding!