+ Start a Discussion
@taani.ax1426@taani.ax1426 

URGENT help Required!!

Hi,

 

I want to add one checkbox on Account thru VF page, I want existing page just with that check box. And also, if that checkbox is checked one field should be enable.

 

Pls help me with code ASAP...

 

Thanks,

Taani!

sfdcfoxsfdcfox

You can't do that. You can only have an entire Visualforce page override, or not at all.

@taani.ax1426@taani.ax1426

Thanks,

 

I made one VF page but only one section which got checkbox in that, i want when checkbox is checked, field "Stite_Address" should be visible, else not. Here is my code.

 

Note i made checkbox in VF page.

 

<apex:page standardController="Contact" >

    <apex:form >
        <apex:pageBlock >

                    <apex:pageBlockSection title="Address Information" columns="2">
                    <apex:outputPanel layout="block"> 
                    <label for="checkbox">Select address from existing address </label> 
                    <input id="checkbox" type="checkbox"/> 
                    </apex:outputPanel>
                     <apex:inputField value="{!contact.Site_Address__c}" />                   

                     

                               
                <apex:inputField value="{!Contact.MailingStreet}"/>
                <apex:inputField value="{!Contact.MailingCity}"/>
                <apex:inputfield value="{!Contact.MailingState}"/>
                <apex:inputfield value="{!Contact.MailingPostalCode}"/>
                <apex:inputfield value="{!Contact.MailingCountry}"/>
               
                                             


                            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Please tell me how to approach this..

 

sfdcfoxsfdcfox

Use <apex:inputCheckbox> instead of <input type="checkbox">, and set the value attribute to a public boolean in your page's controller:

 

public boolean selectExistingAddress { get; set; }

 

<apex:inputCheckbox value="{!useExistingAddress}" />

 Your fields can be conditionally rendered using the boolean:

 

<apex:inputField value="{!Contact.MailingStreet}" rendered="{!not useExistingAddress}" />