0

For some reason our select dropdown is not required and does not validate the entry. It already contains the class 'required-entry' for the select.

What am I missing here?

<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
    <div class="fieldset">
        <ul class="form-list">
        <h2 class="head">Contactform</h2>    
            <li>
                <div class="field">
                    <label for="titel" class="required"><span><em>*</em><?php echo Mage::helper('contacts')->__('Titel') ?></span></label>
                    <div class="input-box title">
                        <input type="radio" name="titel" id="titeldhr" value="Dhr." checked><label for="titeldhr">Dhr.</label>
                        <input type="radio" name="titel" id="titelmevr" value="Mevr."><label for="titelmevr"> Mevr.</label>
                </div>
                </div>
            </li>
            <li class="fields">
                <div class="field">
                    <label for="name" class="required"><span><em>*</em><?php echo Mage::helper('contacts')->__('Fullname') ?></span></label>
                    <div class="input-box">
                        <input autofocus name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Fullname') ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
                    </div>
                </div>
            </li>
            <li>
                <div class="field">
                    <label for="email" class="required"><span><em>*</em><?php echo Mage::helper('contacts')->__('Emailaddress') ?></span></label>
                    <div class="input-box">
                        <input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Emailaddress') ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
                    </div>
                </div>
            </li>
            <li>
                <label for="telephone"><span><?php echo Mage::helper('contacts')->__('Phone') ?></span></label>
                <div class="input-box">
                    <input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Phone') ?>" value="" class="input-text validate-telephone" type="text" />
                </div>
            </li>
            <li>
                <label for="orderid"><span><?php echo Mage::helper('contacts')->__('Ordernumber') ?></span></label>
                <div class="input-box">
                    <input name="orderid" id="orderid" title="<?php echo Mage::helper('contacts')->__('Ordernumber') ?>" value="" class="input-text validate-telephone" type="text" />
                </div>
            </li>
            <li>
                <label for="dropdown" class="required"><span><em>*</em><?php echo Mage::helper('contacts')->__('Question') ?></span></label>
                <div class="input-box">
                <div class="dropdown required-entry">
                    <select name="dropdown" id="dropdown" class="required-entry validate-select">
                        <option value="" selected><?php echo $this->__('Please Select'); ?></option>
                        <option name="marketing" value="Marketing"><?php echo $this->__('Marketing'); ?></option>
                        <option name="business" value="Business"><?php echo $this->__('Business'); ?></option>
                        </select>
                </div>
            </li>
            <li>
                <div class="field">
                <label for="onderwerp" class="required"><span><em>*</em><?php echo Mage::helper('contacts')->__('Title') ?></span></label>
                <div class="input-box">
                    <input name="onderwerp" id="onderwerp" title="<?php echo Mage::helper('contacts')->__('Title') ?>" value="" class="input-text required-entry" type="text" />
                </div>
                </div>
            </li>
            <li>

            <li>
                <label for="comment" class="required"><span><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></span></label>
                <div class="input-box">
                    <textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
                </div>
            </li>
            <input type="hidden" name="contact" value="1" />
        </ul>
    </div>
    <?php echo $this->getChildHtml('studioforty9.recaptcha.explicit'); ?>
    <div class="buttons-set">
        <input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
        <button type="submit" title="<?php echo Mage::helper('contacts')->__('Sent') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Sent') ?></span></span></button>
    </div>
</form>
<script type="text/javascript">
    Validation.defaultOptions.immediate = true;
</script>
<script type="text/javascript">
//<![CDATA[
    var contactForm = new VarienForm('contactForm', true);
//]]>
</script>
1

1 Answer 1

1

Remove required-entry class from <select> and remove selected attribute from <option>

 <select name="dropdown" id="dropdown" class="validate-select">
         <option value=""><?php echo $this->__('Please Select'); ?></option>
         <option name="marketing" value="Marketing"><?php echo $this->__('Marketing'); ?></option>
         <option name="business" value="Business"><?php echo $this->__('Business'); ?></option>
 </select>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.