How to fix Yii2 Contact Widget Problem on View Pag

2019-08-27 13:00发布

问题:

I followed the example here Yii2, feedback form in a modal window and I was able to create a contact widget that I added it above the footer of multiple pages on my website using the code <?= FBFWidget::widget([]) ?>.

I stripped the code of the modal box so I am not using that. The problem I am facing now is that whenever I opened a webpage, the page jumps straight to the contact form at the footer instead of showing the top of the page as a any normal browser should do.

I followed all the code as explained in the tutorial so I do not want to post all the codes here. Please see the tutorial

How can I stop this problem.

回答1:

You are using autofocus property on the contact form field name which is forcing the page to go down as the cursor is focused inside the input field, you should remove that property or bind it only if the page url is /contact-us or whatever you are using for the contact form.



标签: php yii2