0

So I have a form with some vue.js data like

<div class="form-group">
     <label class="form-label" for="field_description">Ontology Version</label>
     <input type="text" name="ontology-version" class="form-control" disabled :value="ontology">
</div>

When I submit the form by clicking the submit button, there's no data for the ontology-version in the POST request.

I have a submit button like this <button type="submit" class="btn btn-primary ml-auto">Save</button>

Also, When I inspect the element on chrome, I see that no value is set

inspect element chrome

Arnold Ewin
  • 1,113
  • 1
  • 13
  • 26
  • How are you submitting the form, what does the rendered HTML look like when you do, and what *is* being sent? – robinsax Mar 08 '19 at 21:20
  • hello, @robinsax I've edited the question to add more info. – Arnold Ewin Mar 08 '19 at 21:23
  • You are leaving out code and logic in your question that will help someone find you an answer. Show us what your vue code looks like, show us the rest of your markup because youre just showing one `div` element. Tip: Avoid using images. and by the way, you are sending a request to `10.10.10.10`... does that address even exist? Look in network tab in dev tools and see what the request/response looked like – Isaac Vidrine Mar 08 '19 at 21:36
  • Possible duplicate of [Disabled form inputs do not appear in the request](https://stackoverflow.com/questions/7357256/disabled-form-inputs-do-not-appear-in-the-request) – tony19 Mar 08 '19 at 22:21
  • 2
    The `ontology-version` input is disabled, so it's not included in the form data. Use `readonly` instead of `disabled`. – tony19 Mar 08 '19 at 22:21

2 Answers2

2

As said in comments and previous answer if you submit disabled input field .It wont be sent when request is made so pass it as readonly if you are intend to send this value.

<div class="form-group">
     <label class="form-label" for="field_description">Ontology Version</label>
     <input type="text" name="ontology-version" class="form-control" readonly :value="ontology">
</div>
vuecoder
  • 38
  • 4
0

Disabled input fields are not sent when the request is made.

This is by design, so you can filter fields out.

Radu Diță
  • 13,476
  • 2
  • 30
  • 34