This topic is locked

Force user to press save for the master table if changes made in detail table

3/8/2020 4:18:40 AM
PHPRunner General questions
J
jacktonghk authorDevClub member

In a master/detail form, I need to validate the master table whenever a user made any changes to the detail table. I added the validations in the Before Update Event for the master table, it works with the Save button, how can I make it work with the 'BackToList' button? Thanks.

Sergey Kornilov admin 3/9/2020

When the user clicks the Save button data is committed to the database and there is something we can validate. I'm not quite sure what exactly you can validate when the user clicks 'Back To List' button.

J
jacktonghk authorDevClub member 3/10/2020



When the user clicks the Save button data is committed to the database and there is something we can validate. I'm not quite sure what exactly you can validate when the user clicks 'Back To List' button.


I have to do it because I need to update the header record based on what is input in the detail records. I can do it in the after updated/added event for the detail records, but it slows down the response time. I would like to check it and update the header record when user finished all the detail records update. So it also works if I can disable the back to list button whenever detail record has been changed. Can I do it? Thanks.

Sergey Kornilov admin 3/10/2020

Yes, you certainly can. Here is how you can disable the button:

https://xlinesoft.com/phprunner/docs/getitembutton(itemid_recordid).htm
And the best way is to use Details table Field Events to trigger this code:

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

J
jacktonghk authorDevClub member 3/10/2020



Yes, you certainly can. Here is how you can disable the button:

https://xlinesoft.com/phprunner/docs/getitembutton(itemid_recordid).htm
And the best way is to use Details table Field Events to trigger this code:

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


Thank you for your advice. Now I can disable the Back to List button with the field events in the detail page. I tried to enable it again in the header page javascript onload event but it failed. Where should I place the code to enable the key every time when the edit page is shown? Thanks again.

Sergey Kornilov admin 3/10/2020

This button is enabled by default so there is no need to add any code at all.

J
jacktonghk authorDevClub member 3/12/2020



This button is enabled by default so there is no need to add any code at all.


I mean after I disabled it, how can I enable it again when another master record is brought to edit page?

Sergey Kornilov admin 3/12/2020

The same article show how to both enable and disable the button:

https://xlinesoft.com/phprunner/docs/getitembutton(itemid_recordid).htm

J
jacktonghk authorDevClub member 3/13/2020



The same article show how to both enable and disable the button:

https://xlinesoft.com/phprunner/docs/getitembutton(itemid_recordid).htm



Yes, I put the codes in the beader edit page onload event but it didn't work. Is it the right place for me to put the removeclass in order to enable every time before displaying the edit page? Thanks.

A
ayctech 3/19/2020



Yes, I put the codes in the beader edit page onload event but it didn't work. Is it the right place for me to put the removeclass in order to enable every time before displaying the edit page? Thanks.


try with jquery, replace the name with the button name
$("input[id^=value_precio_total_compras]").prop('disabled', true);

$("input[id^=value_precio_total_compras]").prop('disabled', false);

$("a[id^=trigger-test-value_hora_desde_1]").css({"display":"none"});

$("a[id^=trigger-test-value_hora_desde_1]").css({"display":false});

J
jacktonghk authorDevClub member 3/24/2020



try with jquery, replace the name with the button name
$("input[id^=value_precio_total_compras]").prop('disabled', true);

$("input[id^=value_precio_total_compras]").prop('disabled', false);

$("a[id^=trigger-test-value_hora_desde_1]").css({"display":"none"});

$("a[id^=trigger-test-value_hora_desde_1]").css({"display":false});


I will try. Thank you.