-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pjax with mutiple submit buttion #3719
Comments
Hi, I have the same issue, I am using a pjax form with two submit buttons. Anyone has a solution for this issue ? Thanks Here is my view (form simplified): And my controller: |
I think this should be moved to the yii2-pjax repository since it looks like a javascript issue. can @yii-bot do it? |
https://github.com/yiisoft/jquery-pjax/blob/master/jquery.pjax.js#L151 and https://github.com/yiisoft/jquery-pjax/blob/master/jquery.pjax.js#L161 It seems this is an html5 and jquery issue. We might fix it with this http://stackoverflow.com/questions/15398355/jquery-ajax-does-not-get-submit-button-name i |
https://jsfiddle.net/q0f5x6rh/ i built this fiddle. Looks like the I was searching for solutions on how to know which submit button triggered the event and all of them imply rewritting the way the and finally i searched for which browsers support the we should tag this as "wont fix" and add on the docs how to work around this using the other solution implies a rewrite for |
I didn't test it, but why does the execution come to that |
@SilverFire I provided a jsfiddle so you just need to run it. Basically So if the class |
Now I get it, thank you for detailed explanation. I'm OK with tagging this issue as wont. |
jquery/jquery#2321 jquery won't fix it either. Looks like the only 'solution' is to drop support for IE 9 and alike. |
I am using multiple submit button. I want name of submitted button name. I am have this code in controller
if (Yii::$app->request->getIsAjax() || Yii::$app->request->getIsPjax()) {
if ($model->load(Yii::$app->request->post())) {
echo $_POST['saveList'];}
else{
echo 'other';
}
}
This is my button
echo Html::submitButton($model->isNewRecord ? 'Save and Show List' : 'Update and Show List', ['name' => 'saveList', 'value' => '1', 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
echo Html::submitButton($model->isNewRecord ? 'Save and Create New' : 'Update and View', ['name' => 'saveList', 'value' => '2', 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
The text was updated successfully, but these errors were encountered: