0

This input tag is disabled but I want to submit this form value.

<input type="text" name="quantity" value="400" class="field left" disabled />

Please help me about this tag. Thanks in advance.

1
  • 1
    You can take this field as hidden. So it will not be visible and it will also be submitted in the form Commented Jun 8, 2015 at 5:10

4 Answers 4

3

Try using readonly instead of disabled

<input type="text" name="quantity"  value="400" class="field left" readonly />

If you still want it grayed out, you can set a background color:

<input type="text" name="quantity" value="200" style="background-color: #f0f0f0;" readonly />
Sign up to request clarification or add additional context in comments.

2 Comments

Its not disable the textbox. That's why user can edit this but I don't want this. I want user can see the value but can't edit. And submit the value.
The readonly attribute prevents the user from editing the textbox value.
2

Use hidden field.

<input type="hidden" name="quantity" value=400>

Disabled one can be there too, just remove the name attribute.

<input type="hidden" name="quantity" value=400>
<input type="text" value="400" class="field left" disabled>

1 Comment

The value didn't submit.
1

Take hidden field

<input type="hidden" name="quantity"  value="400" class="field left"/>

So it will not be visible and it will also be submitted in the form

Comments

1

Use read-only and hidden to do this as disabled values cannot be submitted.If you do not want the user to edit the values ,then use a text element instead and read its value along the form using onsubmit attribute of form tag.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.