duanheyi7147 2014-12-02 20:54
浏览 40

Javascript生成的提交按钮不在Firefox中发布

I have seen similar posts related to this question but none have proven useful.

I have a several javascript-generated submit buttons for a form.

PHP sets certain parameters for functions depending on which button is pushed. The problem is that the submit buttons do not get added to the POST array AT ALL if they are generated by javascript; If I put submit buttons directly into the view they work just fine. This is only a problem in Firefox

NOTE: this is not a problem with the form actually submitting - just that the name=>value of the submit button is not being passed to POST.

$('#my-total-dial').highcharts(Highcharts.merge(gaugeOptions, {
    yAxis: {
        min: 0,
        max: myTotalRecords,
        title: {
          text: 'All Time'
        }
    },

    credits: {
        enabled: false
    },

    series: [{
        name: 'All',
        data: [myTotalRecords],
        dataLabels: {
            format: '<div style="text-align:center"><span style="font-size:18px;color:' +
                ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y}</span><br/></div>' +
                   '<button name="my-total-records-view" class="glyphicon glyphicon-eye-open" title="View Records"></button><button name="my-total-records-csv" class="glyphicon glyphicon-file" title="Export Records to Spreadsheet"></button>'
        },
        tooltip: {
            valueSuffix: ' records'
        }
    }]

}));

In Chrome, this is what is spit out by POST:

array(3) { ["_token"]=> string(40) "XB16S144KnTue3ER6x4H8mdQO1rwxGP6BmAciYvK" ["my-total-records-view"]=> string(6) "Submit" ["user_name"]=> string(1) "1" }

And this is what I get in Firefox

array(2) { ["_token"]=> string(40) "UTKWISXMNvUfGjfFxxya8ojYXSgGc8dS5kUS5Hck" ["user_name"]=> string(1) "1" } 
  • 写回答

1条回答 默认 最新

  • dsigh7478 2014-12-02 20:58
    关注

    By default <button> elements does not submit the form. Use <input type='submit'> instead.

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?