Page 1 of 1

radio button break layout tab

Posted: 2024-10-27 14:10
by soewandi
@Ahmed, FYI: Layout Tab in Detail View break.
Problem: When input field type = ‘radio button’ and user group permission set only to ‘View’, I’ve experienced Layout Tab breaks in Detail View.
I insert code for Layout Tab in hooks/tablename.php on function tablename_dv.
But if user group permission set to ‘Insert’, ‘Edit’, and ‘View’, Layout Tab appears as expected.
I hope you can investigate, is it a bug or not. Thanks.

My regards,
Soewandi

Re: radio button break layout tab

Posted: 2024-10-27 14:16
by jsetzer
(screenshot would help understanding this issue)

Re: radio button break layout tab

Posted: 2024-10-27 15:45
by soewandi
Thanks Mr Jan. My code to make layout tab:

Code: Select all

function databaru_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(); ?>
			<div id="form-tabs">
				<ul class="nav nav-tabs">
					<li class="active"><a href="#marital" data-toggle="tab">Data Marital</a></li>
					<li><a href="#kontak" data-toggle="tab">Data Kontak</a></li>
				</ul>
				<ul class="tab-content">
					<div class="tab-pane active form-horizontal" id="marital"></div>
					<div class="tab-pane form-horizontal" id="kontak"></div>
				</ul>
				</div>
				
		<style>
			#form-tabs .nav-tabs a{ display: block !important; }
		</style>
		
		<script>
			$j(function(){
			$j('#form-tabs').appendTo('#databaru_dv_form');
			/* fields to move to tab data marital */
			$j('#goldarah').parents('.form-group').appendTo('#marital');
			$j('#jenjang').parents('.form-group').appendTo('#marital');
			$j('#marital').parents('.form-group').appendTo('#marital');
			$j('#pasangan').parents('.form-group').appendTo('#marital');
			
			/* fields to move to data kontak tab */
			$j('#alamat').parents('.form-group').appendTo('#kontak');
			$j('#no').parents('.form-group').appendTo('#kontak');
			$j('#kota').parents('.form-group').appendTo('#kontak');
			$j('#kodepos').parents('.form-group').appendTo('#kontak');
			$j('#tlphp').parents('.form-group').appendTo('#kontak');
			$j('#tlprmh').parents('.form-group').appendTo('#kontak');
			$j('#tlpktr').parents('.form-group').appendTo('#kontak');
			$j('#email').parents('.form-group').appendTo('#kontak');
			
			})
		</script>
		<?php
			$tabs = ob_get_contents();
			ob_end_clean();
			$html .= $tabs;
	}
If I used option list type radio button. Fieldname: goldarah, jenjang, marital --> are not appear in marital tab
If I used option list type dropdown select, those fieldnames appear are appear in marital tab (as expected).

Re: radio button break layout tab

Posted: 2024-10-30 07:04
by pbottcher
Hi,

I believe Radio input is created differently in AppGini. So the usual $j('#FIELDNAME').parents('.form-group') will not work.

You can try

Code: Select all

$j('[for="FIELDNAME"]').parents('.form-group')
instead.

Re: radio button break layout tab

Posted: 2024-10-31 12:43
by soewandi
@pbottcher, thank you for your help. I've tried your suggestion but still not success to place the radio button field in the TAB. May be this image can help.
Image

And the code as

Code: Select all

function databaru_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(); ?>
			<div id="form-tabs">
				<ul class="nav nav-tabs">
					<li class="active"><a href="#marital" data-toggle="tab">Data Marital</a></li>
					<li><a href="#kontak" data-toggle="tab">Data Kontak</a></li>
				</ul>
				<ul class="tab-content">
					<div class="tab-pane active form-horizontal" id="marital"></div>
					<div class="tab-pane form-horizontal" id="kontak"></div>
				</ul>
				</div>
				
		<style>
			#form-tabs .nav-tabs a{ display: block !important; }
		</style>
		
		<script>
			$j(function(){
			$j('#form-tabs').appendTo('#databaru_dv_form');
			/* fields to move to tab data marital */
			$j('[for="goldarah"]').parents('.form-group').appendTo('#marital');
			$j('[for="jenjang"]').parents('.form-group').appendTo('#marital');
			$j('[for="marital"]').parents('.form-group').appendTo('#marital');
			$j('#pasangan').parents('.form-group').appendTo('#marital');
			
			/* fields to move to data kontak tab */
			$j('#alamat').parents('.form-group').appendTo('#kontak');
			$j('#no').parents('.form-group').appendTo('#kontak');
			$j('#kota').parents('.form-group').appendTo('#kontak');			
			})
		</script>
		<?php
			$tabs = ob_get_contents();
			ob_end_clean();
			$html .= $tabs;
	}
My regards,
Soewandi

Re: radio button break layout tab

Posted: 2024-10-31 14:45
by pbottcher
Hi Soewandi,

which version of Appgini are you using?

You can try

$j('label.contains("THELABELOFTHEFIELD")').parents('.form-group')

e.g.

Code: Select all

$j('label.contains("Gol Darah")').parents('.form-group')

Re: radio button break layout tab

Posted: 2024-10-31 17:35
by soewandi
Hello pbottcher, I used AG Ver 24.17 (last version). With your new code:

Code: Select all

$j('label.contains("Gol Darah")').parents('.form-group')
still didn't get the right results.
Anyway I thank you for your effort to help me.

My regards,
Soewandi

Re: radio button break layout tab

Posted: 2024-10-31 20:32
by pbottcher
Hi Soewandi,

there is a typo in my code.

Please use

Code: Select all

$j('label:contains("Gol Darah")').parents('.form-group')
instead.

Re: radio button break layout tab

Posted: 2024-11-01 04:42
by soewandi
Hello pbottcher, your new code

Code: Select all

$j('label:contains("Marital")').parents('.form-group')
still didn't work.
Image

Code: Select all

function databaru_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(); ?>
			<div id="form-tabs">
				<ul class="nav nav-tabs">
					<li class="active"><a href="#marital" data-toggle="tab">Data Marital</a></li>
					<li><a href="#kontak" data-toggle="tab">Data Kontak</a></li>
				</ul>
				<ul class="tab-content">
					<div class="tab-pane active form-horizontal" id="marital"></div>
					<div class="tab-pane form-horizontal" id="kontak"></div>
				</ul>
				</div>
				
		<style>
			#form-tabs .nav-tabs a{ display: block !important; }
		</style>
		
		<script>
			$j(function(){
			$j('#form-tabs').appendTo('#databaru_dv_form');
			/* fields to move to tab data marital */
			$j('label:contains("Marital")').parents('.form-group').appendTo('#marital');
			$j('#pasangan').parents('.form-group').appendTo('#marital');
			
			/* fields to move to data kontak tab */
			$j('#alamat').parents('.form-group').appendTo('#kontak');
			$j('#no').parents('.form-group').appendTo('#kontak');
			$j('#kota').parents('.form-group').appendTo('#kontak');			
			})
		</script>
		<?php
			$tabs = ob_get_contents();
			ob_end_clean();
			$html .= $tabs;
	}
To Mr. Jsetzer and Mr. Pbottcher, I apologize about my English. I'll refresh my problem: fieldname defines as 'options list' can not display in Layout Tab. I insert code for Layout Tab in hooks/tablename.php on function tablename_dv.
Is this a bug or not? Many thanks for all your help.

Best regards,
Soewandi

Re: radio button break layout tab

Posted: 2024-11-01 11:43
by pbottcher
Hi Soewandi,

actuall it is not a bug, as you add your own code, you need to know how to add the code. Different elements are represented in different ways, therefor there is not one solution to cover all possibilites.

Back to you problem.
You may also try

Code: Select all

$j('.form-group.TABLENAME-FIELDNAME').appendTo('#marital');
or

Code: Select all

$j('[name="FIELDNAME"]').parents('.form-group').appendTo('#marital');
or

Code: Select all

$j('#FIELDNAME0').parents('.form-group').appendTo('#marital');

Re: radio button break layout tab

Posted: 2024-11-03 15:35
by soewandi
Hi pbottcher,
Among your code suggestion, at last this code:

Code: Select all

$j('[name="FIELDNAME"]').parents('.form-group').appendTo('#marital');
Working as intended. That “fieldname” place in Marital Tab as expected. Many thanks for your patient and valuable time to guide me.
Best regards,
Soewandi