Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: sago on September 09, 2019, 05:52:41 PM

Title: Override default save action button in settings
Post by: sago 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
Title: Re: Override default save action button in settings
Post by: SKaero 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.
Title: Re: Override default save action button in settings
Post by: sago 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...
Title: Re: Override default save action button in settings
Post by: SKaero 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.
Title: Re: Override default save action button in settings
Post by: sago 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