0

I have a command link which submits the whole form when I try to click on it instead of displaying the error message on the vf page. The vf page code is

    <apex:pageBlockSectionItem rendered="{!shouldDisplayMultiDetailSection}">
                    <apex:input type="date" value="{!recurringTaskLPP.endDate}">
                    </apex:input>
                    <apex:commandLink action="{!calculateEndDate}" value="Calculate End Date"
                                    rendered="true">
                    </apex:commandLink>
            </apex:pageBlockSectionItem>

and the controller code for the same is

 public void calculateEndDate() {
    if (recurringTaskLPP.recurringAmount == null) {
        ApexPages.Message recurringTaskErrorMessage = new ApexPages.Message(ApexPages.Severity.WARNING, 'Amount field and Start Date and Lpp Details Count should not be left empty!');
        ApexPages.addMessage(recurringTaskErrorMessage);
    }
  else if (recurringTaskLPP.getFrequency() == FREQUENCY_TYPE_DAILY) {
            this.calculateEndDateForDailyView();
    }

1 Answer 1

0

For partial page refreshes you need to specify the rerender attribute:

<apex:commandLink action="{!calculateEndDate}" value="Calculate End Date" rendered="true" rerender="msgs"/>

Change msgs to the ID of the section you wish to re-render

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .