Author Topic: Override default save action button in settings  (Read 2063 times)

Offline sago

  • Newbie
  • *
  • Posts: 7
Override default save action button in settings
« on: September 09, 2019, 05:52:41 PM »
Hi there,

I'm here with a new question:

Is possible toshirt override the default save actions in settings pane?

I mean: if I add a new item inside preferences list, for example, roundcube provide me a default save button. I can override the "onclick" of this button in some way?

Thanks to all

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Override default save action button in settings
« Reply #1 on: September 09, 2019, 11:34:24 PM »
It would be possible with Javascript added by a plugin but I'm not sure why you would want to do that.

Offline sago

  • Newbie
  • *
  • Posts: 7
Re: Override default save action button in settings
« Reply #2 on: September 10, 2019, 01:06:03 AM »
Thanks a lot for the hint.

I'm developing  roundcube plugin that show new item inside preferences list.

All works correctly, but when I add a table with custom form with custom options, roundcube automatically add save button with default action (save). I don't know if is possible to prevent the automaticallh creation of that button or if I can change its trigger, but I need to modify the on click actionwith custom alert, custom error, custom http post and so on...

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Override default save action button in settings
« Reply #3 on: September 10, 2019, 12:02:50 PM »
It sounds like you want to use the preferences_save hook https://github.com/roundcube/roundcubemail/wiki/Plugin-Hooks#preferences_save that will allow you to save data or throw errors for the fields you added.

Offline sago

  • Newbie
  • *
  • Posts: 7
Re: Override default save action button in settings
« Reply #4 on: September 11, 2019, 09:39:43 AM »
Hi,

thanks for the hint, @SKaero, but i need to make a post request to server.

I don't know if mi goal is correlate to javascript event "beforesave", but in some way, when I click on save button, I need to make a post request.

Any help is apreciated.

Thanks a lot