Customising The Contact Form


Just a quick question, I needed to customise the contact form and add some additional fields, like last name and contact number.

I quickly managed to get a sent email to include the contact number but couldn’t get the last name to show up in the sent email. The only difference was contact number had a rule associated with it and last name did not.

My questions is, is this normal behaviour? In the end I used the following rule on last name, which fixed my issue and allowed me to include last name in the body of the sent email.


Or is there some other approach I should be using.

Thanks again!

Yes, this is normal behavior. By default, Yii controllers use massive assignment. MA will only assign values to fields that are marked as safe or have a specific validation rule applied - required, length etc.

Wow, thank you so much, this cleared it all up. Very much appreciated!