php - Yii2: Need to click submit button twice, name and id is not "submit" -


problem: have 3 forms in 1 page, have same bug: need click submit button twice in order submit form.

i have discovered common bug , triggered naming button "submit", not case.

here's code:

(first form: change password)

<div id="change-password-form">     <?php $changepasswordform = activeform::begin([         'id'          => 'change-password-form',         "options"     => ["class" => "animated-label"],         "fieldconfig" => ["template" => "{input}\n{label}\n{hint}\n{error}"],     ]); ?>      <div class="row">         <div class="col-md-6">             <?= $changepasswordform->field($changepassword, 'newpassword')->passwordinput() ?>         </div>         <div class="col-md-6">             <?= $changepasswordform->field($changepassword, 'repeatnewpassword')->passwordinput() ?>         </div>     </div>      <div class="row">         <div class="col-md-6">             <?= $changepasswordform->field($changepassword, 'oldpassword')->passwordinput() ?>         </div>         <div class="col-md-6">             <?= html::submitbutton(                 'change password',                 [                     'class' => 'btn btn-primary',                     "style" => "width: 100%",                     'name'  => 'submit-change-password',                     'id'    => 'submit-change-password',                 ]             ) ?>         </div>     </div>      <?php activeform::end(); ?> </div> 

(second form: change email)

<div id="change-email-form">     <?php $changeemailform = activeform::begin([         'id'          => 'change-email-form',         "options"     => ["class" => "animated-label"],         "fieldconfig" => ["template" => "{input}\n{label}\n{hint}\n{error}"],     ]); ?>      <div class="row">         <div class="col-md-6">             <?= $changeemailform->field($changeemail, 'password')->passwordinput() ?>         </div>         <div class="col-md-6">             <?= $changeemailform->field($changeemail, 'email')->textinput() ?>         </div>     </div>      <div class="row">         <div class="col-md-6 col-md-offset-6">             <?= html::submitbutton(                 'change email',                 [                     'class' => 'btn btn-primary',                     "style" => "width: 100%",                     'name'  => 'submit-change-email',                     'id'    => 'submit-change-email',                 ]             ) ?>         </div>     </div>      <?php activeform::end(); ?> </div> 

(third form: change username)

<div id="change-username-form">     <?php $changeusernameform = activeform::begin([         'id'          => 'change-username-form',         "options"     => ["class" => "animated-label"],         "fieldconfig" => ["template" => "{input}\n{label}\n{hint}\n{error}"],     ]); ?>      <div class="row">         <div class="col-md-6">             <?= $changeusernameform->field($changeusername, 'password')->passwordinput() ?>         </div>         <div class="col-md-6">             <?= $changeusernameform->field($changeusername, 'username')->textinput() ?>         </div>     </div>      <div class="row">         <div class="col-md-6 col-md-offset-6">             <?= html::submitbutton(                 'change username',                 [                     'class' => 'btn btn-primary',                     "style" => "width: 100%",                     'name'  => 'submit-change-username',                     'id'    => 'submit-change-username',                 ]             ) ?>         </div>     </div>     <?php activeform::end(); ?> </div> 

as can see, submit buttons have both unique ids , names, correctly resolved desired html code.

e.g. submit button of "change password" looks this:

<button type="submit" id="submit-change-password" class="btn btn-primary" name="submit-change-password" style="width: 100%">change password</button> 

are there solutions or workarounds case? have found solution renaming submit buttons.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -