Z
Z
ZaurK2018-02-15 12:19:04
Yii
ZaurK, 2018-02-15 12:19:04

Is it possible to replace submitbutton with a custom button?

Hello! There is a button in yii2 form with code

<?= Html::submitButton('<span class="btxt">Оставить заявку</span>', ['class' => 'mbutton', 'name' => 'contact-button']) ?>

I need to bring her to mind
<a href="#" class="mbutton"><span class="btxt">Оставить заявку</span></a>

A simple replacement, of course, does not give anything, I registered classes, but submit has its own styles built into the bootstrap by default. Is there a way to do this replacement other than by searching all the styles and overriding them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-02-15
@ZaurK

Good morning.
Add an id to the button and write your rules in css. Or disable bootstrap styles altogether (if you have set your own design) and then there will be no problems.

'assetManager' => [
            'bundles' => [
/*                'yii\web\JqueryAsset' => [
                    'js' => []
                ],
                'yii\bootstrap\BootstrapAsset' => [
                    'css' => []
                ],
                'yii\bootstrap\BootstrapPluginsAsset' => [
                    'js' => []
                ]*/
            ],
            'linkAssets' => true,
        ],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question