This topic is locked
[SOLVED]

 pop up message after add/edit

5/5/2020 10:14:52 AM
PHPRunner General questions
ffrinai author

Hi,

if i put a popup message before/after record added or before/after record updated events

es.

echo '<script>alert("ATTENTION: BLA BLA")</script>';
the message is displayed only if i set:

add next record - stay on Add page (in add page setting)

or

Stay in Edit page (in Edit page setting)
and it is not displayed if i set

return to the list page (in Add or Edit page setting)
is there a way to show the message if i set:

return to the list page (in Add or Edit page setting)?
thanks

Fabio

Admin 5/5/2020

Not sure if I understand the complete configuration.
Do you use a standalone Add page or inline/popup Add page?

ffrinai author 5/6/2020



Not sure if I understand the complete configuration.
Do you use a standalone Add page or inline/popup Add page?


I use standalone Add/Edit Page


but it would be interesting even if you could also display message in inline add / edit pages.
thanks

Admin 5/6/2020

It can be implemented in any configuration but details will be different. I assume that you use the standalone Add or Edit page and you stay on that page after record is added or edited.

  1. AfterAdd event
    Set the session variable that says the record was added.



$_SESSION["RecordAdded"]=1;


2. BeforeDisplay event of the Add page.
Pass this session variable to Javascript OnLoad event.

$pageObject->setProxyValue("RecordAdded", $_SESSION["RecordAdded"]);

$_SESSION["RecordAdded"]=0;


3. Javascript OnLoad event of the Add page.

if (proxy['RecordAdded']==1)

alert('Record was added');


Note: if you redirect user to the List page after the record was added then code from bullets #2 and #3 should be added to respective events of the List page.