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

Monday, February 28, 2022

[FIXED] How to write this html part in CGridView Yii1.1

 February 28, 2022     cgridview, php, yii, yii1.x     No comments   

Issue

This is the column(It is a numerical input with range of numbers between 1 and 60), that I want to add into CGridView, but I want to append terminalcode to the id of this input. In this code everything is working properly, but terminalcode is not appending with id.

   array(
            'header' => 'Validity',
            'name' => 'validity',
            'value' => function(){ return '<input type="number" id="tentacles".$data["terminalcode"] name="tentacles" min="1" max="60">';},
            'type' => 'raw'
    )


Solution

You need to adjust your return value and add $data parameter in value function. Your code would become like this

array(
    'header' => 'Validity',
    'name' => 'validity',
    'value' => function($data){ return '<input type="number" id="tentacles'.$data["terminalcode"].'" name="tentacles" min="1" max="60">';},
    'type' => 'raw'
),

I hope your problem will be solved.



Answered By - MAZ
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

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