Using predefined value in HTML5 [closed]

closed. this question is out of scope and is not currently accepting answers.

want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 3 years ago .

improve this question

I am trying to bring a value to an input text disabled but the field is being shown as empty. I've already removed disabled and it keeps coming blank.

<input type="text" name="anterior" id="anterior" size="13" maxlength="50" disabled="disabled" value"123456,78" />
Author: Webster Moitinho, 2017-10-20

4 answers

1-the attribute disabled is an attribute to indicate what the name itself says 'desabilitato', that is, it will not be proficient within form.

2-even with the attribute disabled, the value appears, in your case it is not appearing because the property 'value' is without the '=', just correct for:

value="123456,78"

3-to have a non-editable input that is accounted for by the form, use the attribute 'readonly', which also means the name itself 'read only', with this attribute the value of the field is not editable, but is skillful within the form.

Your correct input (if you want to submit the data via Form) should be:

<input type="text" name="anterior" id="anterior" size="13" maxlength="50"  value="123456,78" readonly />

And another option (if you do not want the data to be submitted via form) should be:

<input type="text" name="anterior" id="anterior" size="13" maxlength="50"  value="123456,78" disabled='disabled' />
 5
Author: AnthraxisBR, 2017-10-20 12:32:11

Missing the " = " after the value.

Try This:

<input type="text" name="anterior" id="anterior" size="13" maxlength="50" disabled="disabled" value="123456,78" />
 4
Author: Derlei Lisboa, 2017-10-20 10:13:37

Important disabled is a disabled element, is not editable, and is not sent when submitting forms. The best would be to use the readonly which is a read-only element is not editable, but is sent when the form agrees. And readonly you can focus etc, and disabled not.

Readonly example: <input readonly type="text" name="anterior" id="anterior" size="13" maxlength="50" value="123456,78" />

 2
Author: Allan Kehl, 2017-10-20 12:17:01

Missing the equal sign in value. Change from value"123456,78" to value="123456,78".

 2
Author: Leandro Oliveira, 2017-10-20 13:44:23