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
James Nelson
23,956 PointsForms - static text
Hello guys,
I have a form that submits a static piece of text. As well as other form elements of course. The static element cannot be changed by the user, therefore should not be marked up as input etc.
What tag would you guys recommended using to mark this piece of text up?
P.s I cannot take this piece of text out from the form as it must be submitted.
Thanks
1 Answer
Jeremy Germenis
29,854 PointsIf the field is not required to be seen by the user, use a hidden input field:
<input type="hidden" name="fieldName" value="fieldValue">
If you would like the user to see the field but not edit it, use readonly:
<input type="text" name="fieldName" value="fieldValue" readonly>