Hide button in Modal Pop up window

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Hide button in Modal Pop up window

Post by rpierce » 2021-07-27 20:46

I have created a report based on a lesson in Udemy Courses. Is there some code that I can add to the report that will prevent the button from being visible if the user is in a modal popup window such as when they enter an existing record to edit it?

Thank you again!

rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Re: Hide button in Modal Pop up window

Post by rpierce » 2021-07-28 01:25

This may have not been clear enough. The button to print the report is included in several of my tables while in Detail View. Clicking the button prints out a report of the data. I wish to have it so that when a person is viewing previously entered data in a modal pop up of detail view, such as when editing an existing record the button odes not appear.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Hide button in Modal Pop up window

Post by jsetzer » 2021-07-28 06:09

I'm not 100% sure but there could be a request parameter "Embedded" in standard AppGini generated DV model dialogs.

You may evaluate

Code: Select all

(!$_REQUEST['Embedded'] == 1)
before rendering the button.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Re: Hide button in Modal Pop up window

Post by rpierce » 2021-07-28 15:34

Hi again,

Where do I insert this code?

rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Re: Hide button in Modal Pop up window

Post by rpierce » 2021-07-28 18:23

I have this code

Code: Select all

if(isset($_REQUEST['dvprint_x'])) return;
in the hooks/table_name function table_name_dv. It determines if the window is Print Preview. Could another similar line be added to determine if it is a Modal Popup?

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Hide button in Modal Pop up window

Post by jsetzer » 2021-07-29 04:05

rpierce wrote:
2021-07-28 15:34
Where do I insert this code?
Is there some code that I can add to the report that will prevent the button from being visible
At the place you create "the button". I don't know in which file you do this.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Re: Hide button in Modal Pop up window

Post by rpierce » 2021-07-29 19:33

I have this code in Hooks/table_name_dv function.

Code: Select all

	function audit_dv($selectedID, $memberInfo, &$html, &$args) {
			/* if this is the print preview, don't modify the detail view */
		if(isset($_REQUEST['dvprint_x'])) return;
		ob_start(); ?>
		
		<script>
			$j(function(){
				<?php if($selectedID){ ?>
					$j('#audit_dv_action_buttons .btn-toolbar').append(
						'<div class="btn-group-vertical btn-group-lg" style="width: 100%;">' +
								'<button type="button" class="btn btn-warning btn-lg" onclick="print_report()">' +
									'<i class="glyphicon glyphicon-eye-open"></i> Print Report</button>' +
						'</div>'
					);
				<?php } ?>
			});
			
			function print_report(){
				var selectedID = '<?php echo urlencode($selectedID); ?>';
				window.location = 'hooks/audit_rpt_print.php?audit_id=' + selectedID;
			}
			
			
		</script>
		
		<?php
		$form_code = ob_get_contents();
		ob_end_clean();
		
		$html .= $form_code;
	}

rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Re: Hide button in Modal Pop up window

Post by rpierce » 2021-08-16 16:08

Hi again,

I'm stumped. I got some advice from Ahmed and have been experimenting with it and the similar code you provided. I have been able to remove all the buttons on the page in question, but they are removed weather the page is modal or not. If I leave the .val()) with no value, nothing happens. If I set it as .val(1)) -- then the buttons are removed in both modal and normal mode. I have placed the code into the hooks/firstaid.php file in the firstaid_dv function and also in the header and footer extras files with the same results.

Code: Select all

			$j(function() {
				if($j('[firstaid_dv ="Embedded"]').val())
				$j('#firstaid_dv_action_buttons .btn-toolbar').remove();
});
If there is anything I can tell you to help me solve how to remove a button or group of buttons while in MODAL view. Please let me know.

Thanks for any additional assistance...

Ray

Post Reply