No editor.submit on remove

No editor.submit on remove

mirokomiroko Posts: 8Questions: 0Answers: 0
edited November 2012 in Editor
Hi
Strange, but on editor.remove there is no editor.submit generated.
Insert working ok, but not remove. There is no js error in console. The code is :

$('button#ToolTables_objektArsakTabell_1').on('click', function(e){
e.preventDefault()
var tt = window.TableTools.fnGetInstance( $(BasisObjektArsak.editor.s.domTable)[0] );
var selekterteObjektRader = tt.fnGetSelected();
tt.fnSelectNone(); //avselect for å unngå at remove kalles opp 2 ganger (2 gang med [[row_xx,row_yy]]
if(selekterteObjektRader.length == 1){
BasisObjektArsak.editor.message('Er du sikker på at du vil slette markerte raden ?');
BasisObjektArsak.editor.remove( selekterteObjektRader[0] , 'Slette raden',{
"label":"Slett" ,
"fn": function() {console.log("before submit"); BasisObjektArsak.editor.submit(); console.log("after submit");}}
);
return false;
}
....
return false;
});



From log in console:

before submit (own logging)
onPreSubmit event
after submit (own logging)

and nothing more (no onPostSubmit event, no onSubmitSuccess event…, no even onSubmitError event).

Html is generated propely with the form and all fields under .DTE_Form_Content.

Any idea why this is not working ?

Regards Mirek

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Hi Mirek,

    The very first thing that Editor does in the ajax call back hander is fire `onPostSubmit` and there is no condition on that. As such, I wonder if the Ajax request is even being made? Could you possible link me to the page showing the problem please?

    Allan
  • mirokomiroko Posts: 8Questions: 0Answers: 0
    Hi Allan
    As I wrote there is no onPostSubmit event, no onSubmitSuccess event… and so on. There is no ajax request generated att all and the remove form is showing after click on remove button.
    Upgraded to 1.2.2 without any change.
    Create is still working ok. Only remove has problem.
    Regards Mirek
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    It sounds rather like there might be a script error on the page. Does Firebug / Inspector show anything? A link would be really helpful so I can debug it.

    Allan
  • mirokomiroko Posts: 8Questions: 0Answers: 0
    Firebug does not reports any errors, and I can´t send you a link because this is not a public site. I have used code like this several times, without any problems. What can I do in this case ? Debug your code, maybe and see what is stopping ? Should I start at submit or _submit ?

    Mirek
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    I'd suggest `Editor.prototype._submit` if it is firing the `onPreSubmit` event. You aren't returning false in your `onPreSubmit` event are you? That would cancel the submit.

    Allan
  • mirokomiroko Posts: 8Questions: 0Answers: 0
    Hi Allan
    I used validation onPreSubmit, and of the course forget that this validation is only usefull for create!
    But interesting is that the error fired there (with this.error(....)) is not shown, probably because this is connected to the field, and remove box does not showing any field, so it´s impossible to show this error.
    Any way, thank for your help.
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Exactly right - the error will be inserted in tot he DOM element, but the DOM element itself isn't inserted into the page, and therefore its not obvious what has happened exactly.

    Thanks for flagging this up - I'll mark this down to see if it can be improved - perhaps a extra parameter into the onPreSubmit to say explicitly what event is occurring.

    Regards,
    Allan
This discussion has been closed.