I want to make comment as optional part of contact us page. I have removed the class that validates the comment on the contact us form.
<li class="wide">
<label for="comment"><?php echo Mage::helper('contacts')->__('Comments or Questions:') ?></label>
<div class="input-box">
<textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" cols="5" rows="3" ></textarea>
</div>
</li>
it does not show any frontend error but if i don't write any comment i get error message "Unable to submit your request. Please, try again later".
After Help of TBI I found following error -
exception 'Exception' in
/app/code/core/Mage/Contacts/controllers/IndexController.php:92 Stack trace: #0
/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Contacts_IndexController->postAction() #1
/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('post') #2
/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #3
/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #4
/app/Mage.php(683): Mage_Core_Model_App->run(Array) #5
/index.php(87): Mage::run('default', 'store') #6 {main}
To solve it we have to change core file. Just comment bellow line of code on contact module of core the path is /app/code/core/Mage/Contacts/controllers/IndexController.php
//if(!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) { // $error = true; //}
hope this will help others
Better to override the core file.
Copy it to: app/code/local/Mage/Contacts/controllers/
and make your changes to this file. This really helps you know which files you've altered in the course of trying to make Magento work for you.