Search code examples
phpyii2confirm-dialog

How to add a new line in Yii2 Data Confirm


I have a button using the following code in my view...

<?= Html::submitButton('Delete Summary', [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Really long message.<new line>Line 2<new line>Line 3?',
                'method' => 'post',
            ],
        ]) ?>

I want to make the eventual confirmation dialog show my text on different lines, but none of the common notations such as \n, <br>, nor &#10;&#13; work. I also tried putting \\n instead of \n, still it did not work.

How can I make the different parts of my confirmation show on a different line.


Solution

  • Just write as with the newline

    <?= Html::submitButton('Delete Summary', [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Really long message.
                Line 2
                Line 3?',
                'method' => 'post',
            ],
        ]) ;
      ?>