This topic is locked
[SOLVED]

Does afterSave still work?

5/20/2024 1:48:22 AM
PHPRunner General questions
C
Chris Whitehead author

I found documentation to "afterSave" in the help docs and I've been trying to run some javascript after the page is saved, while the "beforeSave" works, the "afterSave" doesn't.

https://xlinesoft.com/phprunner/docs/refreshing_the_list_page_after_editing_in_a_popup.htm

I've enabled the Ajax functionality in the list page settings as the help requests.
img alt

All I'm currently trying to do is echo out the the console.
this.on('afterSave', function(){
console.log( 'after save' );
});

This works.
this.on('beforeSave', function(){
console.log( 'before save' );
});

C
Chris Whitehead author 5/20/2024

It does appear to work but only in an edit popup.not when the edit/add page is opened in a modal from Javascript as follows:

var popup = Runner.displayPopup({
url: Runner.pages.getUrl( table_name ,"add"),
width: 900,
height: 800,
header: 'Add event'
});

fhumanes 5/20/2024

Hello Chris,

I have this article where I explain several things, but one of them is to be able to execute JavaScript after having updated and register.

https://fhumanes.com/blog/guias-desarrollo/guia-76-recopilacion-de-soluciones-habituales-en-phprunner/

img alt

The method is to generate an answer page with the JavaScript that you require in the "After Updated" event.

I hope this helps you.

Greetings,
fernando

C
Chris Whitehead author 5/20/2024

@fernando That was a great solution, I would have stuck with trying to make the "afterSave" and getting nowhere. Thank you for a quick and simple to apply solution.