Jump to content

joomla contact component not showing error messages


diesel1984

Recommended Posts

Hi,

 

The built in joomla contact component (joomla 2.5) is not showing any error messages whenever the user does not input the correct information in one of the fields.  However, when the form is filled out correctly, a success message appears and the email is sent.  I have created a template view override file but when i disabled that and just used the default template file for the com contact component, the error messages still did not display.  Here is the code i have in my template override for com_contact/category:-

 

NOTE - i did try and comment out the line that calls "behavior.formvalidation" but that did not work.  Basically i want it to contact the server and use the server side validation (not client side).  Also, error messages are appearing on other custom forms used throughout the site.

 

Thanks in advance.

 

 

<?php

 /**
 * @package        Joomla.Site
 * @subpackage    com_contact
 * @copyright    Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license        GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.tooltip');

 if (isset($this->error)) : ?>
    <div class="contact-error">
        <?php echo $this->error; ?>
    </div>
<?php endif; ?>

<div class="span_6">
    <div class="formBox">
            <div class="content">
                <form id="contact-form" action="<?php echo JRoute::_('index.php'); ?>" method="post" class="form-validate">
                    <?php echo $this->form->getInput('contact_name', NULL, 'Your name'); ?><br />
                    <?php echo $this->form->getInput('contact_email', NULL, 'Your email'); ?><br />
                    <?php echo $this->form->getInput('contact_subject', NULL, 'Subject'); ?><br />
                    <?php echo $this->form->getInput('contact_message', NULL, 'Message'); ?>
                    <?php
                          if ($this->params->get('show_email_copy'))
                            {
                            echo $this->form->getInput('contact_email_copy');
                            }
                    ?>                    
                    
                    <?php foreach ($this->form->getFieldsets() as $fieldset): ?>
                          <?php if ($fieldset->name != 'contact'):?>
                               <?php $fields = $this->form->getFieldset($fieldset->name);?>
                               <?php foreach($fields as $field): ?>
                                    <?php if ($field->hidden): ?>
                                            <?php echo $field->input;?>
                                    <?php else:?>
                                            <?php echo $field->input;?>
                                    <?php endif;?>
                               <?php endforeach;?>
                          <?php endif ?>
                    <?php endforeach;?>      
                    
                    
                    <button class="button validate" type="submit"><?php echo JText::_('COM_CONTACT_CONTACT_SEND'); ?></button>
                    <input type="hidden" name="option" value="com_contact" />
                    <input type="hidden" name="task" value="contact.submit" />
                    <input type="hidden" name="return" value="<?php echo $this->return_page;?>" />
                    <input type="hidden" name="id" value="<?php echo $this->contact->slug; ?>" />
                    <?php echo JHtml::_( 'form.token' ); ?>                    
                </form>
            </div>
        </div>
</div>        
 
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.