Does anyone know what mfk is....?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Does anyone know what mfk is....?

Post by shasta59 » 2016-03-29 23:31

Using Appgini 5.50

In every tablename_autofill.php there is the line:

$mfk=$_GET['mfk'];

I am trying to figure out what 'mfk' is. When I do a full search of all the files it only returns mfk as a find in the autofill files.

It is probably something obvious but I cannot find out what mfk means, refers to, etc. I will keep hunting and if I figure it out I will post my findings.

I am sure it is something easy but I must just be missing the connection.

Thanks

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Does anyone know what mfk is....?

Post by peebee » 2016-03-30 21:24

Hi Alan,

If you actually have an autofill field included in your project, an $mfk switch is added to the corresponding table's tablename_autofill.php such as this example:

Code: Select all

$mfk=$_GET['mfk'];
	$id=makeSafe($_GET['id']);
	$rnd1=intval($_GET['rnd1']); if(!$rnd1) $rnd1='';

	if(!$mfk){
		die('// no js code available!');
	}

	switch($mfk){

		case 'financier':
			if(!$id){
				?>
				$('aclnumber<?php echo $rnd1; ?>').innerHTML='&nbsp;';
				<?php
				break;
			}
			$res = sql("SELECT `clients`.`id` as 'id', if(CHAR_LENGTH(`clients`.`client`)>200, concat(left(`clients`.`client`,200),' ...'), `clients`.`client`) as 'client', if(CHAR_LENGTH(`clients`.`clientref`)>20, concat(left(`clients`.`clientref`,20),' ...'), `clients`.`clientref`) as 'clientref', `clients`.`licence` as 'licence', if(CHAR_LENGTH(`clients`.`clientadd`)>200, concat(left(`clients`.`clientadd`,200),' ...'), `clients`.`clientadd`) as 'clientadd', if(CHAR_LENGTH(`clients`.`clientsuburb`)>25, concat(left(`clients`.`clientsuburb`,25),' ...'), `clients`.`clientsuburb`) as 'clientsuburb', if(CHAR_LENGTH(`clients`.`clientstate`)>20, concat(left(`clients`.`clientstate`,20),' ...'), `clients`.`clientstate`) as 'clientstate', `clients`.`clientpcode` as 'clientpcode', if(CHAR_LENGTH(`clients`.`phone`)>140, concat(left(`clients`.`phone`,140),' ...'), `clients`.`phone`) as 'phone', if(CHAR_LENGTH(`clients`.`fax`)>140, concat(left(`clients`.`fax`,140),' ...'), `clients`.`fax`) as 'fax', if(CHAR_LENGTH(`clients`.`mobile`)>140, concat(left(`clients`.`mobile`,140),' ...'), `clients`.`mobile`) as 'mobile', if(CHAR_LENGTH(`clients`.`primary`)>220, concat(left(`clients`.`primary`,220),' ...'), `clients`.`primary`) as 'primary', if(CHAR_LENGTH(`clients`.`email`)>40, concat(left(`clients`.`email`,40),' ...'), `clients`.`email`) as 'email', if(CHAR_LENGTH(IF(    CHAR_LENGTH(`towing1`.`invoiceto`), CONCAT_WS('',   `towing1`.`invoiceto`), ''))>200, concat(left(IF(    CHAR_LENGTH(`towing1`.`invoiceto`), CONCAT_WS('',   `towing1`.`invoiceto`), ''),200),' ...'), IF(    CHAR_LENGTH(`towing1`.`invoiceto`), CONCAT_WS('',   `towing1`.`invoiceto`), '')) as 'towbillto', `clients`.`clienttype` as 'clienttype', concat('<img src=\"', if(`clients`.`inactive`, 'checked.gif', 'checkednot.gif'), '\" border=\"0\" />') as 'inactive', `clients`.`spare` as 'spare', `clients`.`spare2` as 'spare2' FROM `clients` LEFT JOIN `towing` as towing1 ON `towing1`.`id`=`clients`.`towbillto`  WHERE `clients`.`id`='$id' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#aclnumber<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['licence']))); ?>&nbsp;');
			<?php
			break;


	}
The corresponding table's tablename_dml.php then includes the following template code:

Code: Select all

// ajaxed auto-fill fields
	$templateCode .= '<script>';
	$templateCode .= '$j(function() {';

	$templateCode.="\tfinancier_update_autofills$rnd1 = function(){\n";
	$templateCode.="\t\tnew Ajax.Request(\n";
	if($dvprint){
		$templateCode.="\t\t\t'jobs_autofill.php?rnd1=$rnd1&mfk=financier&id=' + encodeURIComponent('".addslashes($row['financier'])."'),\n";
		$templateCode.="\t\t\t{encoding: 'UTF-8', method: 'get'}\n";
	}else{
		$templateCode.="\t\t\t'jobs_autofill.php?rnd1=$rnd1&mfk=financier&id=' + encodeURIComponent(current_financier{$rnd1}.value),\n";
		$templateCode.="\t\t\t{encoding: 'UTF-8', method: 'get', onCreate: function(){ \$j('#financier$rnd1').prop('disabled', true); \$j('#financierLoading').html('<img src=loading.gif align=top>'); }, onComplete: function(){".(($arrPerm[1] || (($arrPerm[3] == 1 && $ownerMemberID == getLoggedMemberID()) || ($arrPerm[3] == 2 && $ownerGroupID == getLoggedGroupID()) || $arrPerm[3] == 3)) ? "\$j('#financier$rnd1').prop('disabled', false); " : "\$j('#financier$rnd1').prop('disabled', true); ")."\$j('#financierLoading').html('');}}\n";
	}
	$templateCode.="\t\t);\n";
	$templateCode.="\t};\n";
	if(!$dvprint) $templateCode.="\tif(\$j('#financier_caption').length) \$j('#financier_caption').click(function(){ financier_update_autofills$rnd1(); });\n";


	$templateCode.="});";
	$templateCode.="</script>";
	$templateCode .= $lookups;
Hope that helps you.

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: Does anyone know what mfk is....?

Post by shasta59 » 2016-03-30 21:33

Ah, since I never use autofill, or have not had to for recent projects that would explain why I could not find a trace of mfk in any of the code.

I appreciate the reply.
I will setup a test project with autofill and see what happens.
It was more a quest to understand the entire system that prompted the question.

Thanks

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

Post Reply