netsuite - NetSuite Suitelet 自定义 HTML | 在表单上按提交会导致值为空
问题描述
我正在使用自定义 HTML 创建套件。页面显示正常,但在提交时,我无法获取参数值。
html = html + "<div class='row row_1'>";
html = html + "<select onchange='onItemSelect(event)' class='item_select' name='item_1'>";
html = html + "</select>";
html = html + "<input name='quantity' placeholder='Quantity' type='number' />";
html = html + "<input name='svuuom' disabled placeholder='SVU UOM' type='text' />";
html = html + "<input name='qtysvuuom' disabled placeholder='Qty in SVU UOM' type='text' />";
html = html + "<input name='lot_num' placeholder='Lot Number' type='text' />";
html = html + "<input name='exp_date' placeholder='Expiration Date' type='date' />";
html = html + "<input onChange='calcQtyRemain(event)' name='ac_weight' placeholder='Actual Weight' type='text' />";
html = html + "<input name='averageweight' disabled placeholder='Average Weight' type='number' />";
html = html + "<input name='totalqty' disabled placeholder='Total Quantity' type='text' />";
html = html + "<input name='qtyremaining' disabled placeholder='Quantity Remaining' type='text' />";
html = html + "<button class='row_1 remove nav_button' onClick='removeRow(this)'>Remove</button>";
html = html + "<input type='hidden' name='submit_data' id='submit_data' ></input>";
html = html + "</div>";
html = html + "<button class='nav_button' type='submit' >Submit</button>";
html = html + "<button id='finalize' class='nav_button' onClick='finalizeForm(event)'> Finalize</button>";
html = html + "<button class='nav_button' onClick='addRow()' class='add_row'>Add Row</button>";
html = html + "<script src='https://6511345.app.netsuite.com/core/media/media.nl?id=3240&c=6511345&h=g_fi0R_eVH-pDCr9pidg6_RMLQc"+
"A-ySTQOWrhs3FYIL3NVkc&_xt=.js' /></script>";
html = html + "</form>";
当用户单击 finalize 时,该值被设置为隐藏字段“submit_data”。我想把它作为帖子的参数。如果我在 submit_data 字段上设置 value='Test',我会在 post 上得到这个参数。上面的代码在 get 请求上。我还在链接 JS 文件并在其中执行一些客户端功能。这些函数设置 submit_data 字段的值。
解决方案
问题出在 JS 资源中。与发布操作发生冲突并导致该字段为空。我已经解决了这个问题,我现在完美地抓住了价值。
推荐阅读
- python - 带有 2 个列表/变量的 Python“for 循环”
- scala - 斯卡拉 | 创建列表的第 1 个、第 2 个、..、第 n 个值的新列表
- azure - 在持久函数中控制扇出/扇入模式中的最大并行度
- jmeter - Jmeter中如何根据实际请求命中和TPM设置工作负载模型?
- lua - 如何理解 rename{ old = "temp.lua", new = "temp1.lua" }?
- javascript - 如果我用 AJAX 加载 php 文件,我的函数内容返回 [object HTMLDivElement]
- azure - Azure Log Analytics 查询返回 0 条记录权限问题?
- angular - Ionic 4 - 如何将 id 参数传递到另一个页面并从外部 api 检索 id 的数据
- c++ - 在 ubuntu16.04 上生成运行时犰狳库时出错
- ios - 饼图(iOS 图表)未显示在自定义 tableviewcell 中