0

I am using full calendar for displaying records and i am using drag and drop functionality of full calendar to update record dates.

I want that once update is successful success message should pass from controller to vf page and display in a pop-up and the same for error.

How to pass the message.

Full calendar Event drop :

eventDrop: function(event, delta, revertFunc) {
                if (!confirm("Are you sure about this change?")) {
                    revertFunc();
                }

                var v =   moment(event.start).format("YYYY-MM-DD");
                var v1 =   moment(event.end).format("YYYY-MM-DD");
                var d= new Date(v1);
                d.setDate(d.getDate()-1);
                v1= moment(d).format("YYYY-MM-DD");

                if(v1!='Invalid date' && v!=null){
                    setEvnt(event.id, v,v1); 
                }else{
                    setEvnt(event.id, v,v); 

                }
            },

Action:function:

        <apex:actionFunction name="setEvnt" action="{!setEvent}" reRender="calendar" >
            <apex:param value="" name="item" assignTo="{!eventIdTemp}" />
            <apex:param value="" name="test" assignTo="{!st}"/>
            <apex:param value="" name="test1" assignTo="{!ed}"/>
        </apex:actionFunction>

Controller -

public void setEvent() {

    try{

    for(Position_Reservation_Detail__c e : eventList) {  
            if(e.Id == eventIdTemp) { 
                e.End_Date__c = date.valueof(ed);
                e.Start_Date__c= date.valueof(st);
                update e;
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Saved successfully!'));
            }
        }

    }

    catch (Exception e) {

    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'unsuccessful!'));

    }

    }
  • Do you have an <apex:pageMessages> tag included on the page? You'll need to rerender that as well. – Adrian Larson Dec 15 '16 at 18:24
  • I should write the reRender in action:function for apex:message? – hellraizer Dec 15 '16 at 18:26
  • ok got it.. Can i have this message as a pop-up window as a <Div> tag.. – hellraizer Dec 15 '16 at 18:32
1

You need to add an <apex:pageMessages> tag and rerender it from your <apex:actionFunction>.

<apex:pageMessages id="msgs" />

...

<apex:actionFunction ... rerender="calendar, msgs" />
| improve this answer | |
  • Thank u...Can i have this message as a pop-up window as a modal... – hellraizer Dec 15 '16 at 18:33
  • That is a completely different question. And I think you'll need to make an attempt yourself. But it sounds...non-trivial. – Adrian Larson Dec 15 '16 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.