How to install multiple form buttons on standalone editor form

How to install multiple form buttons on standalone editor form

Stacey1134Stacey1134 Posts: 112Questions: 20Answers: 0
edited April 2023 in Free community support

No error per se, I can't find anywhere in the manuals where this should work, and it probably won't, but I'll ask anyway.
I have come across that infrequent use for a standalone editor. My reasoning to use it is to consistency in my server-side scripts which use editor.

I am trying to add two form buttons, a save and cancel. but editor.buttons() only recognizes the last button. I have tried multiple variations. I normally use button function "heavily" when binding to a table. For this I am not binding to a table.

Here's the code:

        $('#btnSaveRes').on( 'click', function () {
            var finResVal = $('#seccat').select2('val');
            finResVal = '<dd data-editor-field="scanned_mail.resources">'+finResVal+'</dd>';
            $("#resourceList").html(finResVal);         
            editorRes                           
                .buttons({
                    text: 'Save',
                    className: 'btn btn-success',
                    action: function () { this.submit(); } 
                }, {text: 'Cancel',
                    className: 'btn btn-secondary',
                    action: function () { this.close(); } 
                })                    
                .edit();
        } );

I have used [], formButton, multiple .buttons() calls everything I can think of. Can this be done? Thanks.

Edited:
Almost forgot, here is the editor call:

    var editorRes;
    $(document).ready(function() {

        editorRes = new $.fn.dataTable.Editor( {
            ajax: "ajaxReturnLetter.php",
            fields: [ {
                    label: "Scanned Letter:",
                    name: "scanned_mail.id",
                    type: "display",
                    className: 'full block'
                }, {
                    name: "Comrade",
                    type: "display",
                    className: 'full block'
                }, {
                    name: "form.ComradeID",
                    type: "display",
                    className: 'full block'
                }, {
                    name: "scanned_mail.resources",
                    type: "display",
                    className: 'full block'
                }                    
            ]
        } );
        ...

Answers

  • Stacey1134Stacey1134 Posts: 112Questions: 20Answers: 0

    err. scratch this question, I'm going legacy. It seems that edit mode on the unbound editor actually creates a new record even when the call is edit and not create. Not at all what I want or need.

Sign In or Register to comment.