D
D
Dmitry Baibukhtin2014-10-06 15:09:33
Yii
Dmitry Baibukhtin, 2014-10-06 15:09:33

Yii 2 Html::a() options - protection from bad code?

Hello. Please tell me, I'm trying to pass in
Html::a('Delete', ['tasksmanager/task-delete', 'task_id' => $task->id], ['onclick' => 'confirm("Delete?") ;']);
But the onlick attribute just doesn't appear on the link. If you specify 'class' instead of onclick, then the attribute is displayed. Is this protection against bydlokoda?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Zelenin, 2014-10-06
@PiloTeZ

you apparently use a link inside a grid column, and in the default column settings, the type is html, which cleans links from junk using HtmlPurifier. To use the as is reference, you must set the raw type.

A
Anton Artyomov, 2017-02-27
@ArtyomovAnton

I would rather use the data-confirm attribute
Truth is not assured that in .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question