Friday, 2 February 2018

Add custom button in form

frappe.ui.form.on("Sales Invoice", "refresh", function(frm) {
    frm.add_custom_button(__("Do Something"), function() {
        // When this button is clicked, do this

        var subject = frm.doc.subject;
        var event_type = frm.doc.event_type;

        // do something with these values, like an ajax request
        // or call a server side frappe function using frappe.call
        $.ajax({
            url: "http://example.com/just-do-it",
            data: {
                "subject": subject,
                "event_type": event_type
            }

            // read more about $.ajax syntax at http://api.jquery.com/jquery.ajax/

        });
    });
});

No comments:

Post a Comment

Django rest api - filter

views.py from django_filters.rest_framework import DjangoFilterBackend class PollList(viewsets.ModelViewSet):     queryset = X.objects...