When i select stage picklist value as "Closed Lost" in Opportunity, then i want show text fields. By-default these text fields will be hide. I tried so many ways but i didn't get. tried using actionsupport, javascript, jquery. Here i am giving one of my code using jquery. can anyone give solution for this issue. thanks in advance. Here by-default textfields displays, but i don't want it. It must be shown when i select stage picklist as "Closed Lost" only.
<apex:page standardController="Opportunity">
<apex:sectionHeader title="Opportunity Edit" subtitle="New Opportunity" help="www.salesforce.com"/>
<apex:form >
<script type="text/javascript">
function doChange(thiss)
{
if(thiss.value == 'Closed Lost'){
document.getElementById("j_id0:j_id2:j_id4:j_id9:j_id29").style.display='block';
document.getElementById("j_id0:j_id2:j_id4:j_id9:j_id30").style.display='block';
document.getElementById("j_id0:j_id2:j_id4:j_id9:j_id31").style.display='block';
document.getElementById("j_id0:j_id2:j_id4:j_id9:j_id32").style.display='block';
}
else {
document.getElementById("j_id0:j_id2:j_id4:j_id9:j_id29").style.display='none';
document.getElementById("j_id0:j_id2:j_id4:j_id9:j_id30").style.display='none';
document.getElementById("j_id0:j_id2:j_id4:j_id9:j_id31").style.display='none';
document.getElementById("j_id0:j_id2:j_id4:j_id9:j_id32").style.display='none';
}
}
</script>
<apex:pageBlock title="Opportunity Edit" mode="Edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="save & New" action="{!quicksave}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Opportunity information" columns="2">
<apex:pageBlockSectionItem >
<apex:outputLabel > Opportunity Owner</apex:outputLabel>
{!$User.FirstName} {!$User.LastName}
</apex:pageBlockSectionItem>
<apex:inputField value="{!opportunity.CloseDate}"/>
<apex:inputField value="{!opportunity.Name}"/>
<apex:inputField value="{!opportunity.StageName}" onchange="doChange(thiss);"/>
<apex:inputField value="{!opportunity.AccountId}"/>
<apex:inputField value="{!opportunity.Probability}"/>
<apex:inputField value="{!opportunity.Type}"/>
<apex:inputField value="{!opportunity.Amount}"/>
<apex:inputField value="{!opportunity.ForecastCategoryName}"/>
<apex:inputField value="{!opportunity.Sales_Office__c}"/>
<apex:inputField value="{!opportunity.CampaignId}"/>
<apex:inputField value="{!opportunity.UI_Code__c}"/>
<apex:inputField value="{!opportunity.CurrencyIsoCode}"/>
<apex:inputField value="{!opportunity.Jobsite_Location__c}"/>
<apex:inputField value="{!opportunity.LeadSource}"/>
<div id="myid" style="display:none">
<apex:inputField value="{!opportunity.Reason_for_Loss__c}"/>
<apex:inputField value="{!opportunity.Lost_To_whom__c}"/>
<apex:inputField value="{!opportunity.Competitor_s_Price__c}"/>
<apex:inputField value="{!opportunity.Competitor_s_MT__c}"/>
</div>
</apex:pageBlockSection>
<apex:pageBlockSection title="Additional Information" columns="2">
<apex:inputField value="{!opportunity.NextStep}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Description Information" columns="2">
<apex:inputField value="{!opportunity.Description}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>