Click here to Skip to main content
15,314,843 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
HTML
<form action="/<b>insertproduct</b>" id="form_validation" method="post">
    {{!-- <input type="hidden" name="_id" value="{{product._id}}"> --}}
    <div class="form-group form-float">
        <input type="hidden" id="drpcid" name="cid" value="">
        <select class="form-control" id="drpCat" class="text-capitalize">
            <option value="0">Select Category</option>
            {{#each catlist}}
            <option value="{{this._id}}">{{this.name}}</option>
            {{/each}}
        </select>
    </div>
    <div class="form-group form-float">
        <input type="text" class="form-control" value="{{product.name}}"
            placeholder="Product Name" name="name" required>
    </div>
    <div class="form-group form-float">
        <input type="text" class="form-control" value="{{product.price}}"
            placeholder="Price" name="price" required>
    </div>
    <div class="form-group form-float">
        <input type="text" class="form-control" value="{{product.instock}}"
            placeholder="In Stock" name="instock" required>
    </div>
    <div class="form-group form-float">
        <textarea name="description" cols="30" rows="5" value="{{product.description}}"
            placeholder="Description" class="form-control no-resize"
            required>{{product.description}}</textarea>
    </div>
    <button type="submit" class="btn btn-raised btn-primary waves-effect"> Submit</button>
    <span class="btn-success ">{{successmesg}}</span>
</form>


What I have tried:

Tried to check on req.body and req.params in router.get('/insertproduct'){}
But it shows undefined
Posted
Updated 6-Aug-20 1:24am
v2
Comments
Richard MacCutchan 6-Aug-20 6:56am
   
"But it shows undefined"
Do you think it might be useful to show the exact error message and indicate which line the error occurs on?
Sam_k_khan 6-Aug-20 6:58am
   
the drpdown values are not read and submited

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900