function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
aa143aa143 

how to get alert messages in vf page

Hi i am new to salesforce Please some one guide me to achieve the functionality.

<apex:form >
        <apex:sectionHeader title="Contact Edit" subtitle="New Contact"/>
            <apex:pageBlock title="Contact Edit">
                <apex:pageBlockSection title="Contact Information">
                    <apex:inputField value="{!Contact.FirstName}"/>
                    <apex:inputField value="{!Contact.LastName}"/>
                        <apex:inputField value="{!Contact.AccountId}"/>
                        <apex:inputField value="{!Contact.Product__c}"/>

<apex:commandButton value="Add details" action="{!showPopup}" rerender="popup"/>

            <apex:outputPanel id="popup">
        <apex:outputPanel styleClass="popupBg" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="popup" layout="block" rendered="{!displayPopUp}">
                Popup window
                <apex:commandButton value="Hide" action="{!closePopup}" rerender="popup"/>
            </apex:outputPanel>
        </apex:outputPanel>
                </apex:pageBlockSection>
            </apex:pageBlock>

    </apex:form>
</apex:page>

I want to display error messages condition is: 1) LastName is already a mandatory field, Then "account name(lookup field)" must be selected 2nd 2) After selecting "Account Name" , Product__c(product lookup from contact) must be selected. Then User clicks on "Add Details" Page

Conditions when Alert msg appears: 1) If User forgot to select "Account Name" and selected "Prodcut(lookup)" and clicked on "Add Details" then there must be an alert message "Please select Account Name" must appear on vf page. 2) If user selected "Account Name" and forgots "Product" and cliked on "Add Information" then alert msg appears "Please select Product " in vf page.

Please some one guide me to achieve the functionality as i am new it will be so helpful to me.

Note:- Add information is a popup where i will ask to fill details in a form.
Ramu_SFDCRamu_SFDC
The below post might help
https://developer.salesforce.com/forums/ForumsMain?id=906F000000092ujIAA