+ Start a Discussion
N cN c 

How to display the cursor in 2nd field in Vf Pages?

Hi ,
My question is ,i have two fields in Visual fofrce page. at the time of loading the page the cursor will be displaying in fisrt field. i want to display the cursor in 2nd field .

how to solve this problem?
salesforce mesalesforce me
Hi NC....

 
<apex:form id="form">
        <apex:pageBlock title="User Input" id="thePageBlock">
            <apex:pageBlocksection columns="2">
            <apex:inputText value="{!inputValue1}" id="theTextInput1" label="Input 1" tabindex="1">
          
            <!-- action support allows you to add event handlers onto VF components that don't normally support them the "reRender" attribute can point to              any VF component on the page -->
            <apex:actionSupport reRender="refresh" event="onkeyup" />          
        </apex:inputText>
      
        <!-- the "rendered" attribute tells the VF page renderer whether or not to generate the HTML for this component -->
        <apex:outputPanel id="refresh">
            <apex:pageblocksection rendered="{!LEN(inputValue1)>0}">
                 <apex:inputText value="{!inputValue2}" id="theTextInput2" label="Input 2" rendered="true" tabindex="2"/>
            </apex:pageblocksection>
        </apex:outputPanel>
        </apex:pageBlocksection>   
     
        </apex:pageBlock>
    </apex:form>
</apex:page>

u have sufficient ping me..
salesforce mesalesforce me
<apex:page controller="PartialPageRefreshController">

    <apex:form id="form">
        <apex:pageBlock title="User Input" id="thePageBlock">
            <apex:pageBlocksection columns="2">
            <apex:inputText value="{!inputValue1}" id="theTextInput1" label="Input 1" tabindex="1">
          
            <!-- action support allows you to add event handlers onto VF components that don't normally support them the "reRender" attribute can point to              any VF component on the page -->
            <apex:actionSupport reRender="refresh" event="onkeyup" />          
        </apex:inputText>
      
        <!-- the "rendered" attribute tells the VF page renderer whether or not to generate the HTML for this component -->
        <apex:outputPanel id="refresh">
            <apex:pageblocksection rendered="{!LEN(inputValue1)>0}">
                 <apex:inputText value="{!inputValue2}" id="theTextInput2" label="Input 2" rendered="true" tabindex="2"/>
            </apex:pageblocksection>
        </apex:outputPanel>
        </apex:pageBlocksection>   
     
        </apex:pageBlock>
    </apex:form>
</apex:page>
N cN c
it's not working for me.

can you provide me another solution 
salesforce mesalesforce me
Hi check it once...

http://rjpalombo.com/2012/04/override-a-standard-salesforce-page-with-visualforce/
suresh dupadasuresh dupada
Hi Nc,
You can use javascript to select any input components based on their ids, But u need to make sure complete component ID 

<apex:inputText value="{!value1}" id="input1"/>
<apex:inputText value="{!value2}" id="input2"/>

<script>
    document.getElementById('{!$Component.input2}').focus();
</script>