Home yii2 Yii2 Documentation

Yii2 Documentation




let’s have u change input in yii2

& lt;? = $ form- & gt; field ($ model, 'requisitesData ['. $ requisite- & gt; requisite_id. '] ['. $ requisite- & gt; id. '] [value]') - & gt; textInput (['value' = & gt; $ requisite- & gt; value]) - & gt; label (false)? & gt;

let’s say I have a task to add readonly to this input

Help me figure out where to look for information on yii2 regarding the textInput method and how to syntactically insert my readonly into it

There is this site and this method as textInput, and what attributes it may have, which could have my readonly – there is no such list. Described like this:

public $ this textInput ($ options = [])

but what you can stick into this $ options = [] and how to do it syntactically – no information

When I started to study pxp, http://php.net/ was enough for the string, everything is written in detail but how people write in yii2 I don’t understand. but somehow they write. Please understand correctly. I need help not in how to write correctly, but in where and how to find the information I need, in particular, using the example with this readonly.

Thank you.

Answer 1

& lt;? = $ form- & gt; field ($ model, 'name') - & gt; textInput (['maxlength '= & gt; true,' readonly '= & gt; true])? & gt;

everything works great:

& lt; input type = "text" id = "products-name" class = "form-control" name = "Products [name] "readonly =" "aria-required =" true "& gt;

in the options array, list the required attributes and their values.

you can also add custom attributes:

& lt;? = $ form- & gt; field ($ model, 'name') - & gt; textInput (['maxlength '= & gt; true,' newAttr '= & gt; Yii :: $ app- & gt; user- & gt; identity- & gt; last_ip])? & gt;

looks like this:

& lt; input type = "text" id = "products-name" class = "form-control" name = "Products [name] "newattr =" "aria-required =" true "aria-invalid =" true "& gt;

I need help not on how to write it correctly, but on where and how
find the info I need, in particular with this readonly example.

you have already found 2 documentation: the original and the translation. you don’t need more.

try it, you won’t break it.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions