A
|
acpan 1/20/2020 |
Check the online manual that will do that for you:
|
A
|
acpan 1/20/2020 |
Maybe it is better to hide the button when value is not 1. |
M
|
mhollibush author 1/21/2020 |
Maybe it is better to hide the button when value is not 1. In this case, do the SQL query at the before processed event, and use: $pageObject->hideItem("your_custom_button_id", $recordId); where your_custom_button_id is the item id at the designer page for your custom button. ACP
|
![]() |
Sergey Kornilov admin 1/21/2020 |
I believe you guys are talking about two different things here. |
M
|
mhollibush author 1/21/2020 |
I believe you guys are talking about two different things here. @mhollibush is talking about doing something in button Server event while @acpan is talking hiding this button when necessary. The SQL query will be the same in both cases, which can be confusing.
|
A
|
acpan 1/21/2020 |
Okay, let me try to make it a little clearer and easier. Since we are hidding the button based on condition, we move the SQL query to step 2 below to hide the button, as what @Sergey interpreted correctly.
|
M
|
mhollibush author 1/22/2020 |
Okay, let me try to make it a little clearer and easier. Since we are hidding the button based on condition, we move the SQL query to step 2 below to hide the button, as what @Sergey interpreted correctly. Below is the complete start to end steps for your question: Step 1: Insert custom button on View Page Go to Page Designer and insert the custom button. Next, enter code below for the custom button: In button's Server Event:
|
A
|
acpan 1/22/2020 |
Okay, Try below. Slight changes - Use session variable to pass the studid obtained in Process Record Values event to Button's Server event.
|
M
|
mhollibush author 1/23/2020 |
Okay, Try below. Slight changes - Use session variable to pass the studid obtained in Process Record Values event to Button's Server event. ================= Information we have: Table: dog Fields: id: id of dog (primary key of dog table) Note: View page is based on this dog table. Table: studs Fields: studid: primary key of studs table stud: id of dog (foreign key to dog table) active: 1 or 0 (status of dog in studs table) ================= Step 1: Insert custom button on dog table's View Page Go to Page Designer and insert the custom button. Next, enter code below for the custom button: In button's Server Event:
|
A
|
acpan 1/23/2020 |
Check that you use Process Record Values event and NOT before process event. |
M
|
mhollibush author 1/23/2020 |
Check that you use Process Record Values event and NOT before process event. Don't "describe" your debug values, show your debug values here. Uncomment the echo in the event to show the debug values and paste here. ACP
|
A
|
acpan 1/23/2020 |
Okay ... no problem. Good luck with your recovery. |
M
|
mhollibush author 1/25/2020 |
@acpan..
|
A
|
acpan 1/25/2020 |
what is the purpose of extra foreach loop at the begining for your codes? |
M
|
mhollibush author 1/25/2020 |
what is the purpose of extra foreach loop at the begining for your codes?
|
A
|
acpan 1/25/2020 |
Just my personal choice, i will hide values at the "view as/edit as", to make it easy and clean to debug.
|
A
|
acpan 1/25/2020 |
Refer to above comment:
|
M
|
mhollibush author 1/26/2020 |
Refer to above comment:
|
A
|
acpan 1/26/2020 |
Glad it helps. The logging is crucial to get this works. |
![]() |
jadachDevClub member 1/26/2020 |
If your original code is working and you simply want to show a button instead of a link, why not use built in bootstrap. <a href="/your_page/" class="btn btn-default">View Details</a> |
M
|
mhollibush author 1/26/2020 |
If your original code is working and you simply want to show a button instead of a link, why not use built in bootstrap. <a href="/your_page/" class="btn btn-default">View Details</a>
|
A
|
acpan 1/26/2020 |
@jerry brought up a very good point too.
|