1

The contact us page in the RWD theme has the "name" box as the active element when you land on the page so the cursor is in this box and it is highlighted. This is a nuisance on a mobile device because you are hit with a keyboard in your face whenever you go to this page. How can I disable the "name" box being active?

0

Change below code:

<script type="text/javascript">
//<![CDATA[
    var contactForm = new VarienForm('contactForm', true);
//]]>
</script>

to:

<script type="text/javascript">
//<![CDATA[
    var contactForm = new VarienForm('contactForm', false);
//]]>
</script>

Check this file js/varien/form.js

initialize: function(formId, firstFieldFocus){
        this.form       = $(formId);
        if (!this.form) {
            return;
        }
        this.cache      = $A();
        this.currLoader = false;
        this.currDataIndex = false;
        this.validator  = new Validation(this.form);
        this.elementFocus   = this.elementOnFocus.bindAsEventListener(this);
        this.elementBlur    = this.elementOnBlur.bindAsEventListener(this);
        this.childLoader    = this.onChangeChildLoad.bindAsEventListener(this);
        this.highlightClass = 'highlight';
        this.extraChildParams = '';
        this.firstFieldFocus= firstFieldFocus || false;
        this.bindElements();
        if(this.firstFieldFocus){
            try{
                Form.Element.focus(Form.findFirstElement(this.form))
            }
            catch(e){}
        }
    }

If you set firstFieldFocus to false it will not trigger focus on first field.

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.