req.body无法解析name属性数组的输入

时间:2018-05-07 20:50:08

标签: javascript html node.js express handlebars.js

我有一个带有一些名称属性数组的表单。目前,我有两个问题。

(1)表单提交后,我无法解析itemName [],itemValue [],itemQuantity []中的数组值。

(2)我不知道为什么itemName [],itemValue [],itemQuantity []是对象中的字符串。

有人能告诉我做错了吗?

{ sessionUser: '5ae767331e2086537a6026be',
  senderName: 'Mr. Camden Denesik',
  senderPhone: '411-431-6729 x28435',
  senderEmail: 'Pink.Boyer5@yahoo.com',
  senderAddress: '3324 Marvin Hollow',
  senderCity: 'South Ariannaland',
  senderProvince: 'Iowa',
  senderPostalCode: '61394-2622',
  senderCountry: 'Libyan Arab Jamahiriya',
  recipientName: 'Mac Keeling',
  recipientIdNumber: '17462',
  recipientPhone: '009-180-3472',
  recipientEmail: 'Lucas_Schultz67@gmail.com',
  recipientAddress: '91928 Bobbie Port',
  recipientCity: 'Catharineside',
  recipientProvince: 'Iowa',
  recipientPostalCode: '80415',
  recipientCountry: 'Montserrat',
  'itemName[]': [ 'microchip', 'Kaka' ],
  'itemValue[]': [ '135.00', '100' ],
  'itemQuantity[]': [ '95065', '20' ],
  itemTotalValue: '4.00',
  insurance: 'on',
  cargoInsurance: '893.00' }

1 个答案:

答案 0 :(得分:0)

(2)这是javascript如何处理带有特殊字符的属性,尝试访问像字典数组[]这样的变量。避免这种情况的最佳方法是从属性名称中删除LinqQuery = from t in newContext?.TOURNAMENT_D from u in newContext.PLAYERS_LIST.Where(b => t.TD_ROWID == b.PL_TOURNAMENT_REFNO).DefaultIfEmpty() select new { t.TD_ROWID, t.TD_NAME, t.TD_DATE, startDate = t.TD_DATE, endDate = t.TD_DATE, u.PL_FULLNAME, u.PL_COUNTRY, u.PL_REENTRY };

至于(1)我不完全理解你的问题,但我想这与无法访问变量有关。