Submitting Button Value to Controller but fail to post the value

我只是一个虾纸丫 提交于 2019-12-05 05:54:59
Manoj S Kadlag

You are using two submit buttons,so the conflict occur in between two submit buttons. Try changing Yii::$app->request->post('addRow') to Yii::$app->request->post('addmore') for next page try Yii::$app->request->post('nextpage')

just do your submission with ajax and do whatever you want :

    $('.yourForm').on('submit', function (event) {
    event.preventDefault();
    var formdata = new FormData(this);
    var whatEverInAddition = $('SelectYourDesiredElements').val();
    formdata.append("whatEverInAddition", whatEverInAddition );
    $.ajax({
        url: ...
        and so on ...

The value of your two submit buttons can be obtained from \Yii::$app->request->post('command')

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!