function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
steve_andersensteve_andersen 

Can I stop my inputField from getting Focus on VF page load?

I've got a page with a couple forms on it. The main form has some select boxes and one inputField that happens to be a date field.

When the page loads, that date field gets the focus and pops the date picker, which is annoying.



Any ideas how to get it to stop? Here's the code for my form:
 <apex:form >
    <apex:pageBlock title="Create a Payment Schedule" mode="edit">
        <apex:panelGrid columns="3" id="theGrid"  cellpadding="4">
            <apex:outputText value="# of Installments" styleClass="labelCol"/>
            <apex:outputText value="Date of 1st Installment" styleClass="labelCol"/>
            <apex:outputText value="Interval" styleClass="labelCol"/>            
            <apex:selectList value="{!numberofinstallments}" id="installmentCount" multiselect="false" size="1">
                <apex:selectOptions value="{!items}"/>
            </apex:selectList>
            <apex:inputField value="{!thisInstallment.Date__c}"/> 
            <apex:outputPanel id="thePanel">
                <apex:selectList value="{!interval}" id="intervals" multiselect="false" size="1">
                    <apex:selectOptions value="{!intervals}"/>                
                </apex:selectList>
                <apex:selectList value="{!intervalunit}" id="intervalunits" multiselect="false" size="1">
                    <apex:selectOptions value="{!intervalunits}"/>                
                </apex:selectList>
            </apex:outputPanel>
        </apex:panelGrid>
    <apex:pageBlockButtons >
    <apex:commandButton rerender="installmenttable" value="Next"/>
    </apex:pageBlockButtons>
    
    </apex:pageBlock>
    </apex:form>

 

jwetzlerjwetzler
Quite a few posts on the boards with this question.  Here's the first one I found, looks like there's a solution in it.
steve_andersensteve_andersen
Thanks, that did the trick.

Steve