Lasso Soft Inc. > Home


AuthorDominique Guardiola Falco
LicensePublic Domain
Posted08 Apr 2008
Updated08 Apr 2008
More by this author...


This ctag merges the GET and POST parameters of a submitted form, and re-arrange the parameters to group in one value the repeated items coming from input checkboxes or multiple selects.

It returns an array ready for include in your inline, given the name of the parameters match your database fields names.
You can filter the arguments from the POST/GET submission using an array of unwanted names (name=value pairs which don't match any field in your db, or false fields used in your form).
The default separator is a comma (',') but you can choose another.

Sample Usage

//full client_params, repeating fields joined :

//for this form POST :     
    * pair: (choice)=(20058)
    * pair: (choice)=(103)
    * pair: (choice)=(8887)
    * pair: (update)=(news)
    * pair: (id)=(007)
    * pair: (cookie)=(yes)

join_params(-unwanted=array('cookie','update'), -sep='|');

//will return :

array: (pair: (id)=(007)),(pair: (choice)=(20058|103|8887))

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

	-description='Join multiple POST or GET arguments with the same name under the same value, using a custom separator.'
	local('merged_params') = array;

	!local_defined('sep') ? local('sep')= string(',');
	!local_defined('unwanted') ? local('unwanted')= null;
	local('fields_map') = map;
	local('fields_array') = array;
	iterate: #merged_params, local('tmp');
		if: #unwanted !>> #tmp->first;	
			if: #fields_map !>> #tmp->first;	
				#fields_map->(insert: #tmp->first=#tmp->second);		
	iterate:#fields_map, local('tmp');


Related Tags


No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft