by default magento advanced search allows to click the search button without even enter some search words. In my magento this leads to a few seconds of waiting until you finally get a "no products found" page.

I want to do some validation or similar so that it will not be possible to click the search button without entering at least one field.

Can somebody help please?

edit: just a "required" field or the other magento field validations will not help as I still want to allow users to fill out any field (f.e. 1 out of 3) but if I apply the magento validations like "validate-one-required-by-name" all fields are set as "required" because I can only use it in (form.phtml)

<div class="input-box2">
                    <input type="text" name="<?php echo $_code ?>" id="<?php echo $_code ?>" value="<?php echo $this->escapeHtml($this->getAttributeValue($_attribute)) ?>" title="<?php echo $this->escapeHtml($this->getAttributeLabel($_attribute)) ?>"  class="input-text2 <?php echo $this->getAttributeValidationClass($_attribute) ?> validate-one-required-by-name" maxlength="<?php echo $maxQueryLength;?>" />

and all of the text fields used in advanced search are affected by this line.

maybe the "search" button can be changed so that it will only be clickable if at least one field is filled? (like it is at the standard mini-searchbar in magento). this is the code of the button:

  <div class="buttons-set2">
    <button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>


Your Answer

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

Browse other questions tagged or ask your own question.