You need to sign in to do that
Don't have an account?
kfkaal
Activate first input field in a list
I have to iterate through a List of a custom object and display the datafields as inputfields.
My first field is a Picklist, the second is a Date field.
When it's done, it activates the second field (datefield) in the first dataset (it the shows the calendar under the field). I want to have the focus on the first, the Picklist field.
Is there any way, how I could determin that the first input field is selected?
just put the script in the code by this you can avoid the defalut loading on the date field
script:
<script>
function setFocusOnLoad(){}
</script>
after this you can set the focus on the control where ever you want ..
Thanks for the valueable hint.
But as I said: the focus needs to be on the first input field (picklist), not as automatically selected the second field (date).
With your javascript code, I can take the focus away from the datefield. My problem after that is to find the id of the picklist field and set the focus to it.
Either I would need to set the id of the picklist field (and only the first entry) to something like 'firstPicklist', or I would put my Id of the dataset into the id of that picklist field - but then the javascript would need to know about the id of the first dataset.
Any idea about this problem?
try this
<apex:page standardController="Auto__c"> <script>function setFocusOnLoad() {} </script> <apex:form > <apex:pageBlock > <apex:inputField id="ipid" value="{!Auto__c.Naming__c}"/> <script> var ipid = document.getElementById('{!$component.ipid}'); </script> <apex:inputField value="{!Auto__c.Date__c}"/> </apex:pageBlock> </apex:form> <script> ipid.focus(); </script>
</apex:page>
Thank you for your advice.
But my problem is that I have to iterate through a list (somehow like massedit) and build lines of input fields for each dataset.
So, I need to identify the first field (top left) field in this table to be able to set the correct focus.
Any ideas on that?