首页 > 解决方案 > 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 字段的值。

标签: netsuitesuitescript1.0

解决方案


问题出在 JS 资源中。与发布操作发生冲突并导致该字段为空。我已经解决了这个问题,我现在完美地抓住了价值。


推荐阅读