There is a simple form that sends an array of aidishnks in the same way:

<input id="Col_0" type="checkbox" name="Col[0]" value="1"> <input id="Col_1" type="checkbox" name="Col[1]" value="2"> 

etc. Aidishniki are not needed in order to put them in the database, which means there are no CActiveRecord models for them. Question: How can I validate this unique ID in yii.? I just need a function that would trim, cut the tags, check the type, etc. Is it really necessary to create a CFormModel model for this?

  • Besides, I can not find in validators (CValidator) YII trim, strip_tags? It bothers me. - Samat Zhanbekov

1 answer 1

On stackoverflow there is a solution. But in general, it would be better to use another model.

  • In your proposed solution, the model is used. - Samat Zhanbekov
  • I meant rather the second comment there. =) In general, I solved a problem similar to yours by creating an extension. The validateValue () method is added to the descendant of the CSafeValidator class (about the same as in CUrlValidator), and then this descendant is used. - Drimean