1

How Can I Send Form Data like Array

look at the below code , I Can’t set Index in product_attribute[‘index must be here’][‘key’]

<tr v-for="index in attributes">
    <td class="text-left">
    <input type="text" name="product_attribute['index must be here']['key']" value="" placeholder="attribute" class="form-control" autocomplete="off">
</td>
    <td class="text-left">
    <div class="input-group">
        <textarea name="product_attribute['index must be here']['value']" rows="5" cols="70" placeholder="text" class="form-control"></textarea>
    </div>
    </td>
</tr>
1

1 Answer 1

1

You could bind it using v-bind:name or shortly :name as follows :

<input type="text" :name="product_attribute[index]['key']"  ...

and

  <textarea :name="product_attribute[index]['value']" 
Sign up to request clarification or add additional context in comments.

3 Comments

I tried with this but in console ReferenceError: product_attribute is not defined
in fact , I don't want to use ajax for send data I want send with form request
so you should do :name="'product_attribute['+index+']['value']"

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.