Using default value in HTML5 [closed]

0

I'm trying to bring a value into an input text disabled but the field is being shown as empty. I already removed the disabled and it continues to come in blank.

<input type="text" name="anterior" id="anterior" size="13" maxlength="50" disabled="disabled" value"123456,78" />
    
asked by anonymous 20.10.2017 / 12:10

4 answers

5

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

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

value="123456,78"

3 - To have a non-editable input that is counted by the form, use the 'readonly' attribute, which also means the name 'read only', with this attribute the field value is not editable, but is skilful inside of 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' />
    
20.10.2017 / 12:34
4

The "=" was missing after the value.

Try this:

<input type="text" name="anterior" id="anterior" size="13" maxlength="50" disabled="disabled" value="123456,78" />
    
20.10.2017 / 12:13
2

Important disabled is disabled, not editable, and is not sent when submitting forms. The best would be to use readonly which is a read element only 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" />

    
20.10.2017 / 12:20
2

Equal sign missing in value. Change from value"123456,78" to value="123456,78" .

    
20.10.2017 / 15:41