You need to sign in to do that
Don't have an account?

How to hide the field label in vf page?
Hi,


here i have crated a vf page and wrote a script but the labels are not hide please let me know?
This was the below code..
<apex:page standardController="opportunity">
<apex:includeScript value="{!$Resource.jquery}"/>
<apex:sectionHeader title="opportunity Edit" subtitle="{!opportunity.name}"/>
<apex:form >
<apex:pageBlock title="opportunity Edit" mode="edit">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Save & New" action="{!save}" />
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Save & New" action="{!save}" />
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Opportunity Information" columns="2">
<apex:inputField value="{!opportunity.Name}" required="true"/>
<apex:inputField value="{!opportunity.Type}" required="false"/>
<apex:inputField value="{!opportunity.CloseDate}"/>
<apex:inputField value="{!opportunity.StageName}"/>
<apex:inputField value="{!opportunity.LeadSource}" required="false"/>
<apex:inputField value="{!opportunity.AccountId}" required="false"/>
<apex:inputField value="{!opportunity.IsPrivate}" required="false"/>
<apex:inputField value="{!opportunity.CampaignId}" required="false"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Contract Information" columns="1">
<apex:inputField value="{!opportunity.Funding_Type__c}" id="type" onchange="fund(this)"/>
<apex:inputField value="{!opportunity.X60_Minute_Funding_Amt__c}" html-class="dollor" required="false" id="id1"/>
<apex:inputText value="{!opportunity.X60_Minute_Funding__c}" html-class="percentage" required="false" id="id5"/>
<apex:inputText value="{!opportunity.X3_Hour_Funding_Amt__c}" html-class="dollor" required="false" id="id2" />
<apex:inputField value="{!opportunity.X3_Hour_Funding_1__c}" html-class="percentage" required="false" id="id6"/>
<apex:inputText value="{!opportunity.Next_Day_Funding__c}" html-class="dollor" required="false" id="id3"/>
<apex:inputField value="{!opportunity.Next_Day_Funding_Perc__c}" html-class="percentage" required="false" id="id7"/>
<apex:inputText value="{!opportunity.Same_Day_Funding_Amt__c}" html-class="dollor" required="false" id="id4"/>
<apex:inputField value="{!opportunity.Same_Day_Funding_1__c}" html-class="percentage" required="false" id="id8"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script type="text/javascript">
function fund(s){
if(s.value =='$'){
j$ = jQuery.noConflict();
j$(".dollor").show();
j$(".percentage").hide();
}else
if(s.value =='%'){
j$ = jQuery.noConflict();
j$(".dollor").hide();
j$(".percentage").show();
}else{
j$ = jQuery.noConflict();
j$(".dollor").show();
j$(".percentage").show();
}
}
</script>
</apex:page>
here i have crated a vf page and wrote a script but the labels are not hide please let me know?
This was the below code..
<apex:page standardController="opportunity">
<apex:includeScript value="{!$Resource.jquery}"/>
<apex:sectionHeader title="opportunity Edit" subtitle="{!opportunity.name}"/>
<apex:form >
<apex:pageBlock title="opportunity Edit" mode="edit">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Save & New" action="{!save}" />
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Save & New" action="{!save}" />
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Opportunity Information" columns="2">
<apex:inputField value="{!opportunity.Name}" required="true"/>
<apex:inputField value="{!opportunity.Type}" required="false"/>
<apex:inputField value="{!opportunity.CloseDate}"/>
<apex:inputField value="{!opportunity.StageName}"/>
<apex:inputField value="{!opportunity.LeadSource}" required="false"/>
<apex:inputField value="{!opportunity.AccountId}" required="false"/>
<apex:inputField value="{!opportunity.IsPrivate}" required="false"/>
<apex:inputField value="{!opportunity.CampaignId}" required="false"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Contract Information" columns="1">
<apex:inputField value="{!opportunity.Funding_Type__c}" id="type" onchange="fund(this)"/>
<apex:inputField value="{!opportunity.X60_Minute_Funding_Amt__c}" html-class="dollor" required="false" id="id1"/>
<apex:inputText value="{!opportunity.X60_Minute_Funding__c}" html-class="percentage" required="false" id="id5"/>
<apex:inputText value="{!opportunity.X3_Hour_Funding_Amt__c}" html-class="dollor" required="false" id="id2" />
<apex:inputField value="{!opportunity.X3_Hour_Funding_1__c}" html-class="percentage" required="false" id="id6"/>
<apex:inputText value="{!opportunity.Next_Day_Funding__c}" html-class="dollor" required="false" id="id3"/>
<apex:inputField value="{!opportunity.Next_Day_Funding_Perc__c}" html-class="percentage" required="false" id="id7"/>
<apex:inputText value="{!opportunity.Same_Day_Funding_Amt__c}" html-class="dollor" required="false" id="id4"/>
<apex:inputField value="{!opportunity.Same_Day_Funding_1__c}" html-class="percentage" required="false" id="id8"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script type="text/javascript">
function fund(s){
if(s.value =='$'){
j$ = jQuery.noConflict();
j$(".dollor").show();
j$(".percentage").hide();
}else
if(s.value =='%'){
j$ = jQuery.noConflict();
j$(".dollor").hide();
j$(".percentage").show();
}else{
j$ = jQuery.noConflict();
j$(".dollor").show();
j$(".percentage").show();
}
}
</script>
</apex:page>
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inputField.htm
If you put them inside apex:pageblocksectionitem tags, then the label does not appear, as documented at:
http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref_inputField.htm|StartTopic=Content%2Fpages_compref_inputField.htm|SkinName=webhelp
We can hide the label like this
$('label[for=opp3]').css({display:'none'}); where opp3 is the id.
if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.