You need to sign in to do that
Don't have an account?
cignus
Fill standard field automatically
Hi
I am creating a VF page for contacts. When I put the <apex:inputField value="{!ownerId}" on the page it shows and empty input field, but the same thing on the standard layout is filled with current user.
How can I imitate the standard form's behavior with minimum changes in data model?
Cheers
You can do it by adding this javascript to the page: The j_id0: stuff is the id of the element in my example
<script>
window.onload = function ()
{
document.getElementById("j_id0:mainForm:Year").value = "SOMEVALUE OR {!xxxx}";
}
</script>
All Answers
You can do it by adding this javascript to the page: The j_id0: stuff is the id of the element in my example
<script>
window.onload = function ()
{
document.getElementById("j_id0:mainForm:Year").value = "SOMEVALUE OR {!xxxx}";
}
</script>
Is it really how SF does it?
I mean this is something that should be done in business layer. It is a little awkard to pull it up to presentation.
When you choose to go with Visualforce you have to create ALL functionality yourself.
And yes, when SF serves up the standard page, it populates the DOM elements by ID as well