Custom Form Delete Button

Custom Form Delete Button

isport59isport59 Posts: 30Questions: 9Answers: 2
edited April 2015 in Free community support

I'd like to have a delete button in my form. I tried the code below. It generates a confirmation box with a confirm delete button but when I click the button nothing happens. It keeps looping. An answer to my problem would be greatly appreciated.

Here is the link to my page:
http://editor.uhmind.com/examples/api/backNext.html

label: 'delete',
fn: function (e, data, remove)  {
     this.title('Delete row')
     this.buttons('Confirm delete')
     this.message('Are you sure you want to remove this row?')
     this.remove(this);
}

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Answer ✓

    Hi,

    I think the problem is with this.remove( this ). In that context this is the Editor instance (which is why you can call the Editor methods), so passing this into remove() won't work, as remove() is expecting an identifier for the row to be removed.

    What you can do however is use the modifier() method to get that information. So I think simply:

    this.remove( this.modifier() );
    

    should be the only change required!

    Regards,
    Allan

  • isport59isport59 Posts: 30Questions: 9Answers: 2

    That did the trick. Thanks a mile!

    Mike

This discussion has been closed.