PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, March 6, 2022

[FIXED] Yii2, gridview can not show some html tags inside cells

 March 06, 2022     php, yii, yii2, yii2-advanced-app     No comments   

Issue

I'm using GridView widget for displaying data in my Yii2 application. The gridview can not render some of html tags, such as <input> or <button>!.

here is part of my code:

[
     "label" => "Action",
     "format" => 'html',
     "value" => function($data){
           return '<input type="button" value="Action" />';
      }
]

This renders nothing inside <td>, just empty <td></td> !!

What's the problem?


Solution

The "html" formatter is piped through HtmlPurifier to clean it up.

If you want it to pass through without any filtering then use the format "raw" instead of "html"



Answered By - Ed209
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing