I have define array value in multiple select value drop down but when we submit the form it is showing multiple array value error.
Please advice.
Use the serialize() function to serialize all the inputs in one value
$this->request->data['Model']['multiple'] = serialize($this->request->data('Model.multiple'));
and if you want to retrieve data use unserialize() to get your array as it saved .
For this purpose I do array_implode in the beforeValidate function, and array_explode in the afterFind function.
Related
I have an array variable "Names" with this values for example ["Unity","Block","PRD","Monit"] and want to get each of them value into a new variable.
The output desired would be something like:
Variable Group = Unity
Variabel Test = Block
(...)
As this is an array i thought a basic Names[0] would give me the first value and so on for 1,2,3,etc, but on a logic app I can't figure out how that works.
Is this possible?
Thanks
You do know select value from an array have to specific the index, just don't know how to use variable expression.
Use variables('variable_name') get the variable value and then add the parameter [index] behind it to select the value you want. Just like the below picture shows.
I have an array of JSON objects within my database (as depicted by the image below)
How do I search for a specific value within it? Say I want the record where the "ends_at" field is equal to "2018-11-24 08:00:00"
I've tried using
->where('column->starts_at', '2018-11-24 08:00:00')
or even tried
->whereJsonContains('column->starts_at', '2018-11-24 08:00:00').
Within the model I've cast the column to an array - am I missing something, or can this not be done?
Use this:
->whereJsonContains('column', ['starts_at' => '2018-11-24 08:00:00'])
I am writing a common control that will be used to format data inside a grid. It has 2 parameters that user can set:
filter (string) that is used to format value
parameters (any[]) that are used by the filter
In the code I am going to call $filter(filter)(value, ...) - here is my problem. How do I pass my parameters? Each filter can have from no parameters to who knows how many. So, is there a nice way to pass variable number of parameters in Angular? So far I did not run into a way of doing it.
You should be able to do:
$filter(filter).apply(this, parameters)
I know that the standard method for passing named parameters in a get request, is:
?paramName=value&anotherParam=anotherValue...
In my case, I want to pass an array of parameters
However, I want to pass multiple parameters with the same meaning - an array.
In js that would be
var users = ['bob', 'sam', 'bill'];
and I want to pass the users array via get.
What would be the way to accomplish this?
You will need to serialize them into some form of string that can be re-parsed into an array.
For, example, you could use...
?param[]=a¶m[]=b¶m[]=c
...or something like...
?params=[a][b][b].
Hi I got a search filter page and I have a field that's a multiple select so it's value is an array. Is it possible to pass that input's value (w/c is an array) as a parameter or should I use sessions?
Thanks!
your coding will be something like this:
$filters=array($param1,$param2,....);
$result=$this->ModelName->find('all',array('condtions'=>array('ModelName.fieldname'=>$filters)));
I hope this may work.