Create button

Create button

mak1mak1 Posts: 25Questions: 13Answers: 1

Hi Allan,

I am following the tutorial here
https://editor.datatables.net/reference/button/create

as I want to add a 2nd button on the Create modal window. My first button does the normal Create....
for my 2nd button I have the following code

formButtons: [
                {
                    label: 'Create/Approve',
                    fn: function () { this.submit(); }
                },

What I want to do, is to make sure I have some way of differentiating between these two submissions so I know one is Create and the other is Create/Approve on the backend. Is there a way? Seems like "action" is "create" for both and there's no other parameter to distinguish the buttons.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin
    Answer ✓

    Would setting a variable be acceptable - I think that's the only way that you would be able to tell the server which has been clicked. You could have an extra field in the form which is hidden from the end user (hidden) and then call field().val() to set the value in your custom button, letting the server know that that button was clicked.

    Allan

  • mak1mak1 Posts: 25Questions: 13Answers: 1

    Thank you, yes that will work

This discussion has been closed.