heisann999 Posted November 20, 2015 Share Posted November 20, 2015 I'm not very experienced in html. Is there a way to pass on text that is shown as a part of a form (not text that the user fill in, but text written by the programmer in the html-file), without having to write it as "value" in addition? I've checked the W3Schools.com, and tried to search google as well, but I can't find any information on this. I know I can do something like this: <td>Verb1<input type="hidden" name="Verb1" value="Verb1"></td> But is there a way of doing this without having to write the same twice in the html-coding? Link to comment Share on other sites More sharing options...
Ingolme Posted November 20, 2015 Share Posted November 20, 2015 You can have a text type input and set it to readonly. <input type="text" name="Verb1" value="Verb1" readonly> Link to comment Share on other sites More sharing options...
dsonesuk Posted November 21, 2015 Share Posted November 21, 2015 The op wants the name attribute value, WITHOUT the need to fill in the value with the same name attribute value. You should be able to on form submission to create cookie, or save to web storage the name attribute value using JavaScript. But seems pointless as you will know what they will be so you can preempt this in next page. Link to comment Share on other sites More sharing options...
heisann999 Posted November 21, 2015 Author Share Posted November 21, 2015 Thank you for the tip, Ingolme! It works fine with me! Now I just have to change the value! Link to comment Share on other sites More sharing options...
Ingolme Posted November 21, 2015 Share Posted November 21, 2015 The op wants the name attribute value, WITHOUT the need to fill in the value with the same name attribute value. You should be able to on form submission to create cookie, or save to web storage the name attribute value using JavaScript. But seems pointless as you will know what they will be so you can preempt this in next page. What they actually want is to store the value in an input while also displaying it to the user. The fact that the name of the input and its value are the same is just a mistake in the example code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now