Answers.Body: <p>I found it! It took quite a bit of digging about, but eventually I found the files I needed to edit. In case anyone else is struggling with this same issue, here's what you need to do:</p>
  
  <p>Look in the folder 'craft/app/framework/validators/' for a file called 'CRequiredValidator.php'. Open the file in a text editor and look for the text: 'cannot be blank'.</p>
  
  <p>Part of this line reads: '{attribute} cannot be blank.'</p>
  
  <p>You can change the text 'cannot be blank' to whatever you like and can move '{attribute}' to after the alternative text that you've put in without breaking anything. Save and upload your altered file to the correct location.</p>
  
  <p>Now, look in the folder 'contactform/models/' for a file called 'ContactFormModel.php' (probably the only one there).</p>
  
  <p>By default, it has the following written into it:</p>
  
  <pre><code>    return array(
          'fromName'          =&gt; array(AttributeType::String, 'label' =&gt; 'Your Name'),
          'fromEmail'         =&gt; array(AttributeType::Email,  'required' =&gt; true, 'label' =&gt; 'Your Email'),
          'message'           =&gt; array(AttributeType::String, 'required' =&gt; true, 'label' =&gt; 'Message'),
          'messageFields'     =&gt; array(AttributeType::Mixed),
          'subject'           =&gt; array(AttributeType::String, 'label' =&gt; 'Subject'),
          'attachment'        =&gt; AttributeType::Mixed,
      );
  </code></pre>
  
  <p>The bits you need to alter to complete the customised error messages are found after <code>'label' =&gt;</code></p>
  
  <p>Save and upload your second altered file to the correct location, and check out the new error messages for your form!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-19T17:18:01.787Z
Answers.Text: Note that by doing this you're changing that message for every required field in Craft, not just the Contact Form plugin.  It's definitely not recommended to manually change any files in `craft/app` as they can/will be overwritten at any time by an auto/manual update.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-19T21:05:42.220Z
Answers.Text: Thanks, Brad. It's a good point, but the default error messages were so clunky. Would you be able to point me towards a better method? Another problem with my method was that I've now broken the translation of the error message.
Answers.UserDisplayName: ADigitalMark
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-19T15:30:50.220Z
Answers.LastActivityDate: 2016-02-19T15:30:50.220Z
Answers.UserDisplayName: ADigitalMark
Body: <p>Firstly, thanks very much for the help I've already had from members here. It's been straightforward and easy, even for a newbie like me, to understand.</p>
  
  <p>At the moment, I'm working on editing one of the last pages on a client's site, the Contact Us page and am hoping to be able to use the Pixel &amp; Tonic, Contact Form plugin. But, after some inspection of the Readme and the files that run the plugin, I have been unable to find the following:</p>
  
  <p><strong>1)</strong> How do I create/edit the error messages that the form generates?</p>
  
  <p><strong>2)</strong> Can I use the form to allow a user to enter their phone number? If so, what should the code look like in the template?</p>
  
  <p>I would like the final form to look like the screenshot below.</p>
  
  <p><a href="https://i.sstatic.net/8cMln.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8cMln.png" alt="Contact Form Preview"></a></p>
  
  <p>Any help that anyone can provide would be most appreciated.</p>
  
  <p>With kind regards,</p>
  
  <p>Mark</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thanks to <a href="https://craftcms.stackexchange.com/questions/6627/contact-form-plugin-from-pixel-tonic?rq=1">this post</a>, I've realised how easy it is to add a new field for the phone number (and assume I add the code wherever I want the new field to appear(??)), but am still clueless about the error messages.</p>
  
Tags: <plugin-contactform>
Title: Editing error messages and allowing a phone number input in a P&T Contact Form
ThreadText: # Editing error messages and allowing a phone number input in a P&T Contact Form
  
  (Asked by: username_0 on 2016-02-19)
  
  Firstly, thanks very much for the help I've already had from members here. It's been straightforward and easy, even for a newbie like me, to understand.
  
  At the moment, I'm working on editing one of the last pages on a client's site, the Contact Us page and am hoping to be able to use the Pixel & Tonic, Contact Form plugin. But, after some inspection of the Readme and the files that run the plugin, I have been unable to find the following:
  
  **1)** How do I create/edit the error messages that the form generates?
  
  **2)** Can I use the form to allow a user to enter their phone number? If so, what should the code look like in the template?
  
  I would like the final form to look like the screenshot below.
  
  [![Contact Form Preview](https://i.sstatic.net/8cMln.png)](https://i.sstatic.net/8cMln.png)
  
  Any help that anyone can provide would be most appreciated.
  
  With kind regards,
  
  Mark
  
  **EDIT**
  
  Thanks to [this post](https://craftcms.stackexchange.com/questions/6627/contact-form-plugin-from-pixel-tonic?rq=1), I've realised how easy it is to add a new field for the phone number (and assume I add the code wherever I want the new field to appear(??)), but am still clueless about the error messages.
  
  **Tags:** plugin-contactform
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-02-19. Score: 0 | Accepted answer
  
  I found it! It took quite a bit of digging about, but eventually I found the files I needed to edit. In case anyone else is struggling with this same issue, here's what you need to do:
  
  Look in the folder 'craft/app/framework/validators/' for a file called 'CRequiredValidator.php'. Open the file in a text editor and look for the text: 'cannot be blank'.
  
  Part of this line reads: '{attribute} cannot be blank.'
  
  You can change the text 'cannot be blank' to whatever you like and can move '{attribute}' to after the alternative text that you've put in without breaking anything. Save and upload your altered file to the correct location.
  
  Now, look in the folder 'contactform/models/' for a file called 'ContactFormModel.php' (probably the only one there).
  
  By default, it has the following written into it:
  
  ```
      return array(
          'fromName'          => array(AttributeType::String, 'label' => 'Your Name'),
          'fromEmail'         => array(AttributeType::Email,  'required' => true, 'label' => 'Your Email'),
          'message'           => array(AttributeType::String, 'required' => true, 'label' => 'Message'),
          'messageFields'     => array(AttributeType::Mixed),
          'subject'           => array(AttributeType::String, 'label' => 'Subject'),
          'attachment'        => AttributeType::Mixed,
      );
  
  ```
  
  The bits you need to alter to complete the customised error messages are found after `'label' =>`
  
  Save and upload your second altered file to the correct location, and check out the new error messages for your form!
  
  > **Comments:**
  > **username_1**: Note that by doing this you're changing that message for every required field in Craft, not just the Contact Form plugin.  It's definitely not recommended to manually change any files in `craft/app` as they can/will be overwritten at any time by an auto/manual update.  
  > **username_0**: Thanks, username_1. It's a good point, but the default error messages were so clunky. Would you be able to point me towards a better method? Another problem with my method was that I've now broken the translation of the error message.  
  
  ---
  
  