contactForm question

I am adjusting the standard Yii contactForm and there are some fields that I do not want required. However, when I remove an item from the required array in the the rules() function, the data sent from the form for that particular field is always NULL even if it was filled in.

Does anyone know what might be causing this? I’m sure it’s something simple that I’m overlooking.


You have to have at least one validation rule for it.

An attribute without a validation rule is considered ‘unsafe’ and thus will not be assigned a field value from the form.

That was it. I knew it was something simple I was overlooking.


Or you can just make them safe=)

Yes, that’s what I did.