Monday 1 May 2017

Unable to get the input value to the form in the database and web page

• I have developed the submission form and trying to retrieve the submitted values from the database in one web page. • In the submission page, the value of the category option is not taken and retrieved in the web page. Also, the value for the option category option is not stored in the database.
• I think there is a mismatch between the value and the field. • I have attached the HTML, javascript code regarding the form

HTML code for undercategory option:

<div>
        <input id="radioDefault_5" name="UnderCategory" type="hidden">
        <div>
          <input id="Field5_0" name="Field5" type="radio" value="First Choice" tabindex="5">
          <label class="choice" for="Field5_0">17</label>
        </div>
        <div>
          <input id="Field5_0" name="Field5" type="radio" value="First Choice" tabindex="5">
          <label class="choice" for="Field5_0">19</label>
        </div>
        <div>
          <input id="Field5_1" name="Field5" type="radio" value="Second Choice" tabindex="6">
          <label class="choice" for="Field5_1">21</label>
        </div>
        <div>
          <input id="Field5_2" name="Field5" type="radio" value="Third Choice" tabindex="7">
          <label class="choice" for="Field5_2">23</label>
        </div>
      </div>
    </fieldset>
  </div>

Code for routing the submitted data in the web page

router.get('/get-data', function(req, res, next) {
  var resultArray = [];
  mongo.connect(url, function(err, db) {
    assert.equal(null, err);
    var cursor = db.collection('user-data').find();
    cursor.forEach(function(doc, err) {
      assert.equal(null, err);
      resultArray.push(doc);
    }, function() {
      db.close();
      res.render('data', {items: resultArray});
    });
  });
});

Code for displaying the submitted data in the web page

<tr>
  <th>Name1</th>
  <th>Name2</th>
  <th>Gender</th>
  <th>Sports</th>
  <th>Category</th>
  <th>Team_Size</th>
  <th>StudentID</th>
  <th>Contact</th>
  <th>EmailID</th>
  <!-- <th>ID</th> -->
</tr>

<tr>
  <td></td>
  <td></td>
  <td></td>
  <td></td>
  <td></td>
  <td></td>
  <td></td>
  <td></td>
  <td></td>
  <!-- <td></td> -->
  </tr>


Kindly help me out of this



via youtube3

No comments:

Post a Comment