Form - Missing Button

Form - Missing Button

tomrichtomrich Posts: 14Questions: 0Answers: 0
edited December 2013 in Editor
Once a record has been added the status is set to Unapproved by default
You then need to select the record, click the Approved button which will popup a different form that allows you to confirm the Supplier and asks you to add the order number.

This works fine however there is no button on the form that allows me to save the changes?

Any help in getting a button to save the form would be greatly appreciated.

http://clipboardplus.co.uk/labdocs.co.uk/labdocs_tracking.html


[code]
// Insert Approved Button Start
{
"sExtends": "editor_edit",
"editor": editorapprove,
"sButtonText": "Approve",
"fnClick": function (button, config) {
var tt = this;
var rows = tt.fnGetSelected();
editorapprove.edit(rows[0], '', [], true);
editorapprove.set('statusID', 'Approved');
editorapprove.set('statusdateID', new Date());
editorapprove.title('Confirm Approved');
editorapprove.submit(function (json) {
tt.fnSelectNone();
});
}
},
// Insert Approved Button End

[/code]

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    > editorapprove.edit(rows[0], '', [], true);

    The third parameter there is specifically removing the buttons in the form (an empty array of buttons === no buttons).

    I think you might want to pass in `false` as the fourth parameter to have it not display the form and just submit immediately perhaps?

    Allan
  • tomrichtomrich Posts: 14Questions: 0Answers: 0
    edited December 2013
    Hi Allan,

    My new code as follows still doesn't work and I know I'm missing something stupid.
    Also, the form cannot be submitted immediately as a order number needs to be entered at approval

    [code] // Insert Approved Button Start
    {
    "sExtends": "editor_edit",
    "editor": editorapprove,
    "sButtonText": "Approve",
    "fnClick": function (button, config) {
    var tt = this;
    var rows = tt.fnGetSelected();
    editorapprove.edit(rows[0], '', [{
    "label": "Submit",
    "fn": function () {
    editorapprove.submit();
    }
    }], true);
    editorapprove.set('statusID', 'Approved');
    editorapprove.set('statusdateID', new Date());
    editorapprove.title('Confirm Approved');
    // editorapprove.submit(function (json) {
    tt.fnSelectNone();
    // });
    }
    },
    // Insert Approved Button End [/code]
  • tomrichtomrich Posts: 14Questions: 0Answers: 0
    The code above seems to fire the validation check and even the progress spinner is displayed, its just not updating the table and closing the form?

    I know its definitely to do with me stupidly missing the button array originally but I just can't figure it out?
  • tomrichtomrich Posts: 14Questions: 0Answers: 0
    I think it maybe a validation on a hidden field stopping the save event.
    I'll check when I get home from work.
  • tomrichtomrich Posts: 14Questions: 0Answers: 0
    I was right, I had a hidden field that was empty but trying to validate.
    Can't believe I missed it.
  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    Heh - good to hear you got it resolved :-)

    Allan
This discussion has been closed.