<script type="text/javascript">
document.getElementById('{!$component."id field here"}').value = 'Whatever you want to have as default value';
</script>
ok. so i managed to find some clues on how to enter a default value into a apex code inputfield. But can't figure out how to get the current user into the field. Here's my code:
<script type="text/javascript">
document.getElementById('{!$component."id field here"}').value = 'Whatever you want to have as default value';
</script>
solved. thank SeAlVa
All Answers
ok. so i managed to find some clues on how to enter a default value into a apex code inputfield. But can't figure out how to get the current user into the field. Here's my code:
Apex code:
<apex:page controller="testControllerExt" showheader="true" sidebar="true" standardstylesheets="true">
<apex:form id="TheForm">
Value:{!TextInput}
<apex:inputtext id="TextInputField" value="{!TextInput}">
<apex:commandbutton action="{!ProcessForm}" id="theSubmitButton" rerender="TheForm" status="AjaxStatus" value="Submit">
</apex:commandbutton></apex:inputtext></apex:form>
</apex:page>
Apex class:
public with sharing class testControllerExt {
public string TextInput {get; set;}
public testControllerExt() {
TextInput = '{!$User.FirstName}!';
} // constructor
public pagereference ProcessForm () {
return null;
}
} // main class
actually, this still doesn't solve my default value problem. I still need to use:
<apex:inputField value="{!Case.Ownerid}"/>
and then put in a default value in the field.
solved. thank SeAlVa