I see cakephp 3.0 has same multiple select validation but I am getting
error Array to string conversion
here is what I tried
-notEmpty('input_field', __('Please select option(s)'))
-add('input_field', [
'multiple'=[
'rule'=['multiple', ['min'=1]],
'message'='Please select option
Hello Experts,
We have multiple select validation in cakephp 2.x
public static function multiple($check, $options = array(),
$caseInsensitive = false) {
..
}
any idea what is equivalent validation in cakephp 3.0 ?
Thanks
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us
What field are you trying to validate?
On Friday, February 27, 2015 at 2:02:00 PM UTC+1, Cake Developer wrote:
I see cakephp 3.0 has same multiple select validation but I am getting
error Array to string conversion
here is what I tried
-notEmpty('input_field', __('Please select option(s
wrote:
What field are you trying to validate?
On Friday, February 27, 2015 at 2:02:00 PM UTC+1, Cake Developer wrote:
I see cakephp 3.0 has same multiple select validation but I am getting
error Array to string conversion
here is what I tried
-notEmpty('input_field', __('Please select
to search for multiple
brands?
On Monday, April 16, 2012 4:48:04 AM UTC-7, Owlio wrote:
Hi,
I hope someone can shed some light on this, it's driving me crazy. I have
a multiple select list with options generated from a database. The problem
is that the select name is being set
,
I hope someone can shed some light on this, it's driving me crazy. I
have a multiple select list with options generated from a database. The
problem is that the select name is being set, incorrectly, as follows:
name=data[Server][brand][]
When it should be:
name=data[Server][brand
Hi,
I hope someone can shed some light on this, it's driving me crazy. I have a
multiple select list with options generated from a database. The problem is
that the select name is being set, incorrectly, as follows:
name=data[Server][brand][]
When it should be:
name=data[Server][brand
to search for multiple
brands?
On Monday, April 16, 2012 4:48:04 AM UTC-7, Owlio wrote:
Hi,
I hope someone can shed some light on this, it's driving me crazy. I have
a multiple select list with options generated from a database. The problem
is that the select name is being set, incorrectly
If you're using the core 'multiple' validation rule then I was involved in
many discussions about this some time back, the following search should
provide all the reading you require:
https://groups.google.com/forum/#!searchin/cake-php/validate$20multiple$20rule
HTH, Paul.
--
Our newest site
I all, I'm trying to use the multiple validation method, but it
seems that it doesn't works...
This is my model:
https://gist.github.com/1380696
Thanks in advance for any help! ^^
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP
Robert,
No, there is no bug, what you're trying to achieve has nothing to do
with saving data. You're creating a control mechanism where a
checkbox designates if an action should be performed on a row or not.
Cake has no built in functionality to deal with this.
One way to achieve what you want
I just can not figure this out. Read the book
http://book.cakephp.org/#!/view/1390/Automagic-Form-Elements
in my user_index view I am looping through the results of the
find(all). for each pass of the foreach I want to set a checkbox so I
can mass select each user_id. I can not get the multiple
A checkbox only holds true or false, but you are trying to store the user id in
it. I'd change it to a 'selected' field and then inspect $this-data for array
keys where 'selected' = true. I'd retain your user id field too (as a text
field) otherwise you won't know the ids of the selected rows.
Hi Jeremy, Thank you so much for the reply. I kind of got it
working. after searching some old posts it seems it is a possible bug
with the security component.
Hi Mates,
Hope baking is in full swing.
I am coding a multi select box for categories. I am using Tree
Behavior for categories.
The thing I am up to is I don't want to allow users to select top
categories in the list. I mean the category is displayed as an
hierarchy, but I dont want the users to
On Wed, Apr 20, 2011 at 12:05 PM, Mr.Jayesh jayeshach...@gmail.com wrote:
Hi Mates,
Hope baking is in full swing.
I am coding a multi select box for categories. I am using Tree
Behavior for categories.
The thing I am up to is I don't want to allow users to select top
categories in the list.
Hi,
that seems a bit weird to me at first look, because I am using HABTM
relations, and edit functions created by the bake tool, and I have my items
selected, without having had to do anything more. Perhaps if you could paste
the relevant lines from your edit controller and view, somebody here
Hi,
this might in fact be nothing more than a browser issue. Do you have any
html debugging tool like Firebug etc? If so, inspect the html for the
select box and verify that some of the options have value selected or
similar.
Hope this helps.
Cheers,
ojonam
--
Our newest site for the
to the Edit view for one of my
controllers.
I need to know how to get the options/answers associated to a multiple
select list to be selected by default.
Thanks!
On Apr 11, 9:46 am, ojonam manojo10...@gmail.com wrote:
Hi,
this might in fact be nothing more than a browser issue. Do you have any
- Pool
- Street
It's possible, however, that each Listing can have multiple Views.
Here is where I'm having a problem...
There are 3 tables total:
- listings
- propviews (id, name)
- listings_propviews (listing_id, propview_id)
On the edit view I have a multiple select box, which is pulling
Thanks for all of the comments. But nothing seems to be resolving this. I
posted my code for the View, Controller and Model w/ a debug() dump. I am
able to insert a single record just fine, but when it comes to adding
multiple records, the index in the array becomes numerical and it needs to
Hi all,
I am working on a project for a client and had a programmer create the
app. Funding is out so I am taking over the project myself and have
little/no knowledge of cakePHP (I have used codeIgniter instead). I
am having problems getting a multiple select to work. Can someone
help
and had a programmer create the
app. Funding is out so I am taking over the project myself and have
little/no knowledge of cakePHP (I have used codeIgniter instead). I
am having problems getting a multiple select to work. Can someone
help?
The multiple select shows up on the page as directed
I just saw your other post on this same subject.
per the CakePHP Book (http://book.cakephp.org/view/1031/Saving-Your-
Data):
saveAll(array $data = null, array $options = array())
Used to save (a) multiple individual records for a single model or
(b) this record, as well as all associated
See my reply to your other post on this same issue (HABTM w/ Multiple
Select type Field and saveAll() on multiple records.)
On Feb 9, 9:21 pm, OldWest ja...@jasonwydro.com wrote:
Does anyone know if this is possible within the CakePHP framework?
http://stackoverflow.com/questions/4950487
On 02/09/2011 11:10 PM, OldWest wrote:
I wanted to know if you have much experience with saveAll() w/ HABTM on
a multiple select field?
I can get the Zips populated from the plans_zips table (with the below),
but I cannot get the zips to save in the HABTM plans_zips table..
...
*?php echo
:15 AM
To: cake-php@googlegroups.com
Subject: Re: HABTM w/ Multiple Select type Field and saveAll() on multiple
records.
Hi,
If you use InnoDB tables in MySQL you can use a transaction:
http://deadlytechnology.com/web-development-tips/jquery-cakephp-tips/
This lets you define a for loop and do
I wanted to know if you have much experience with saveAll() w/ HABTM on a
multiple select field?
I can get the Zips populated from the plans_zips table (with the below), but
I cannot get the zips to save in the HABTM plans_zips table..
...
*?php echo $this-Form-input('$i.Zip', array(*
* 'type
...@jasonwydro.com wrote:
I wanted to know if you have much experience with saveAll() w/ HABTM on a
multiple select field?
I can get the Zips populated from the plans_zips table (with the below), but
I cannot get the zips to save in the HABTM plans_zips table..
...
*?php echo $this-Form-input('$i.Zip
Yes. But I am doing this for multiple record entries. In other words, I am
adding multiple records at once.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP
Does anyone know if this is possible within the CakePHP framework?
http://stackoverflow.com/questions/4950487/cakephp-multiple-entry-fields-w-saveall-habtm-multiple-records-insert-not-savi
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new
Hi guys,
I have three tables
categories campaigns
campaign_categories
--
--
-
id
id id
name name
category_id
status
detail
Take a look at the CakePHP book at these locations:
http://book.cakephp.org/view/1390/Automagic-Form-Elements
which explains about the form elements and the automagic functionality
of it!
http://book.cakephp.org/view/1390/Automagic-Form-Elements#options-options-1394
which explains how your data
:58 am, TimG t...@gurske.com wrote:
Hey,
I have a multiple select that is being displayed as checkboxes thanks
to the array('multiple'='checkbox') code. I need to set it somehow
so that users can only select new items. So they can check new
checkboxes but not uncheck boxes that are already
Good idea - thanks!
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To
Hey,
I have a multiple select that is being displayed as checkboxes thanks
to the array('multiple'='checkbox') code. I need to set it somehow
so that users can only select new items. So they can check new
checkboxes but not uncheck boxes that are already checked when the
page loads.
I figured out
Hi Guys can you help:
When using Automagic Select on a HABTM I cant get the automagic
multiple selct box to show the selected items when I edit a user
( showing saving data works great on add)
Tables:
Users
States
User_States
Users HABTM States
In my controller I have :
function add(){
Anyone?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
Nevermind it works nothing wrong with the code shown above it was a
problem in my models.
'foreignKey' = 'state_id',
'associationForeignKey' ='user_id',
had these mixed up in my model once i fixed that it all worked :)
--~--~-~--~~~---~--~~
You
Hi Guys can you help:
When using Automagic Select on a HABTM I cant get the automagic
multiple selct box to show the selected items when I edit a user
( showing saving data works great on add)
Tables:
Users
States
User_States
Users HABTM States
In my controller I have :
function add(){
If you don't want to add them by hand ever time. I've written a
function that will do it for you:
http://www.richardathome.com/blog/cakephp-auto-populating-foreign-key-dropdown-fields
On May 8, 3:16 pm, brian bally.z...@gmail.com wrote:
Did you fetch a list of Users in your controller?
I want checkboxes displaying all users in my database.
For example:
In my app some users can add new documents and they can choose which
users have the right to see the docs.
So in my fileupload form I want to add checkboxes showing all users.
But this doesn´t work.
In the documentation of
Did you fetch a list of Users in your controller? FormHelper can only
work with what's already set in your $viewVars.
On Fri, May 8, 2009 at 5:34 AM, GetIT david.bruen...@t-online.de wrote:
I want checkboxes displaying all users in my database.
For example:
In my app some users can add new
I'm not too sure what you mean by having a blank page after submitting
the form. Anyways, are you submitting an array of multiple id's? I
don't know why your select name is data[Did][id][]. It should just be
data[Did][id]
echo $form-input('id');
Is this what you are doing?
On Nov 21, 12:48 am,
The blank page is essentially a page with no code at all. No html
headers no script no nothing. What it should do is return to the same
controller/action and run the debug($this-params);
When I do this:
echo $form-input('id', array('type' = 'select', 'multiple'='true',
'options' =
app_controller I had:
var $components = array('Auth', 'Acl', 'Security');
If I take out the security component the multiple select works fine.
So I guess for now I wont use that component. I don't know if I found
a bug or what but maybe this info will help someone else in the
future.
On Nov 21, 7
I have been banging my head against this issue all evening. Hopefully
someone might notice a typo or something.
I have simplified my form down to nothing in hopes of finding the
issue. I also decided to write the form object rather than using the
form helper to see if it help me find my bug.
Hi,
I have a select field which is output as part a pagination loop, i.e.
foreach ($data as $company):?
tr
... other data ...
td
?php echo $form-input('accountTypeNames',
array('onchange'
='this.form.submit()', 'label' = '', 'options' = array
Hi all,
I just started working with the ajax helper, but I'm running into a
problem. I've three select boxes, le't's call them foo, bar and baz.
I've set up observers to update bar when foo changes and to update baz
when bar changes. However, if bar changes due to a change in foo, baz
doesn't
On 6 dic, 19:19, dandreta [EMAIL PROTECTED] wrote:
I have an HABTM relation between ModelA and ModelB.
In the add view of A, I have created two lists, one with all B
elements of the database and other one empty . I pass elements of the
first list to the second one with javascript and the
On Dec 9, 4:45 pm, dandreta [EMAIL PROTECTED] wrote:
Thanks for your response.
But I dont understand how I can do this.
Can you explain me, please?
Regards
I'm assuming you're using javascript for item switching, so setting
select.options[index].selected to true would do the trick.
There is
Thanks for your response.
But I dont understand how I can do this.
Can you explain me, please?
Regards
On 7 dic, 12:16, Serge Rodovnichenko [EMAIL PROTECTED] wrote:
Try to set/reset a 'selected' attribute of OPTION when moving options
between two lists.
On Dec 6, 9:19 pm, dandreta [EMAIL
Try to set/reset a 'selected' attribute of OPTION when moving options
between two lists.
On Dec 6, 9:19 pm, dandreta [EMAIL PROTECTED] wrote:
I have an HABTM relation between ModelA and ModelB.
In the add view of A, I have created two lists, one with all B
elements of the database and other
I have an HABTM relation between ModelA and ModelB.
In the add view of A, I have created two lists, one with all B
elements of the database and other one empty . I pass elements of the
first list to the second one with javascript and the second list will
contain the B elements that will be
Gwoo, the multiple = checkbox is not working for me... I have
Cake 1.2 pre-beta revision 5875... Do I have to upgrade to make this
technique work? Thanks!
Martin
On Nov 22, 3:10 pm, Gwoo [EMAIL PROTECTED] wrote:
This thread was highjacked by Mr. Gould. Please do not reply to a
message and
This feature is only available in the latest SVN version of Cake.
On Nov 25, 2:51 pm, mbavio [EMAIL PROTECTED] wrote:
Gwoo, the multiple = checkbox is not working for me... I have
Cake 1.2 pre-beta revision 5875... Do I have to upgrade to make this
technique work? Thanks!
Martin
On Nov
This thread was highjacked by Mr. Gould. Please do not reply to a
message and change the subject.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to
Hi there,
Im using Cake 1.2.0.5427alpha.
Have unsuccesfully tried some of these. What is the best way?
Basically just trying to implement it into the following Structure
products
id
product
price
proposal
--
id
client_id
status
products_proposals
PROTECTED] wrote:
hi Stefan,
Is it possible to use checkboxes instead of a multiple select to
represent data in a many-to-many relation?
I wrote a helper ages ago that does just that, check
outhttp://cakeforge.org/snippet/detail.php?type=snippetid=190
hth
jon
--
jon bennett
On Oct 7, 3:00 pm, Jon Bennett [EMAIL PROTECTED] wrote:
hi Stefan,
Is it possible to use checkboxes instead of a multiple select to
represent data in a many-to-many relation?
I wrote a helper ages ago that does just that, check
outhttp://cakeforge.org/snippet/detail.php?type=snippetid
hi Stefan,
Is it possible to use checkboxes instead of a multiple select to
represent data in a many-to-many relation?
I wrote a helper ages ago that does just that, check out
http://cakeforge.org/snippet/detail.php?type=snippetid=190
hth
jon
--
jon bennett
w: http://www.jben.net/
iChat
Also there are two great articles in the bakery that will help you:
http://bakery.cakephp.org/articles/view/create-multiple-checkboxes-instead-of-a-multiple-select-in-your-views
http://bakery.cakephp.org/articles/view/alternative-methods-for-working-with-hasandbelongstomany-associations
On Oct
Is it possible to use checkboxes instead of a multiple select to
represent data in a many-to-many relation?
I have a categories table connected to a resources table via a
categories_resources table, and have set up the HABTM relations in the
two models.
Now, in my resource add/edit views, I
Hi!
I have a multiple select option where the use can select 1 or more
owners.
I need to query the database based on the owners selected.
There was an article i read
http://groups.google.com/group/cake-php/browse_thread/thread/e6321043e861d1c1/cca8f2f008e7fb32?lnk=gstq=select+multiple
a multiple select option where the use can select 1 or more
owners.
I need to query the database based on the owners selected.
There was an article i
readhttp://groups.google.com/group/cake-php/browse_thread/thread/e6321043...
this is like A or B.What I need is A or B or C or. i.e it depends
$owners = array('1','2','3')
$equipment = $this-Equipment-findAll( array('Equipment.owner_id'=
$owners) );
This will generate WHERE `Equipment`.`owner_id` IN ('1','2','3') which
sounds like what you want.
--~--~-~--~~~---~--~~
You received this message because
Thanks alot for the help on the OR condtions,but my problem related to
the checking the owners is based on the number of owners the user
selects.I cant code it directly.Its based on user selection.
Any idea?
Thanks!
Kashyap
--~--~-~--~~~---~--~~
You received this
On Jun 6, 9:32 am, hashkash [EMAIL PROTECTED] wrote:
Thanks alot for the help on the OR condtions,but my problem related to
the checking the owners is based on the number of owners the user
selects.I cant code it directly.Its based on user selection.
Any idea?
don't use an OR and read what
from a multiple select option.
Im not using a findAll() but using a query() because when i used the
findall()before posting on this group i got a few errors. so im using
the query().
Kashyap
On Jun 6, 12:37 pm, AD7six [EMAIL PROTECTED] wrote:
On Jun 6, 9:32 am, hashkash [EMAIL PROTECTED] wrote
here is a part of the controller code
http://bin.cakephp.org/view/486635630
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To
no of owners keep growing as and when they register.
The owners are selected from a multiple select option.
rhetoricalAnd in what form is that available to you in the
controller. do pr ($this-data['Equipment']['owner']); how does that
var change when you select 1, 2 or n owners in your form./rhetorical
Hi,
Does anyone can suggest me a good tutorial, how to use the
HtmlHelper::selectTag function with multiple selection fields?
How can I achieve, that when editing an existing DB entry the multiple
select list renders with the current DB values?
(I tried first the simple select, but it did
Does anyone can suggest me a good tutorial, how to use the
HtmlHelper::selectTag function with multiple selection fields?
you're surely having a laugh aren't you, this has been the most active
topic today!
jon
--
jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM):
From the API:
selectTag ( $fieldName,
$ optionElements,
$ selected = null,
$ selectAttr = array(),
$ optionAttr = null,
$ showEmpty = true,
$
for the tables
involved and the vanilla CakePHP validation is presenting the same
behavior with multiple select listboxes. If any field does not
validate, the multiple selects loose their selected options.
Norman
On 16 fev, 20:06, Norman [EMAIL PROTECTED] wrote:
One thing I am sure about
this behavior with multiple select boxes. But
I was not able to find it.
Norman
On 16 fev, 12:34, Norman [EMAIL PROTECTED] wrote:
I have some views for a model with a mix of fields, two of these
--~--~-~--~~~---~--~~
You received this message because you are subscribed
I have a form in which a multiple select list that represent an HABTM
relationship. The select is generated with $html-selectTag() (I
started from a baked controller).
I've got two problems.
First: when a validation error occurs, the $selected array that is
passed back to the selectTag function
Second: when my main item is saved, the HABTM are not.
Solved no2: relationship table name was not in alphabetical order
(colors_fruits).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to
The array constructed by selectTag after submit contains keys as its values,
so I believe you can just array_flip() that array for next time, which
will have keys as its keys.
No need to change the helper.
Hope this helps.
Sohei
--~--~-~--~~~---~--~~
You
Works fine, but feel a little awkward.
I'm still wondering if this a normal behavior.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
zonathen wrote:
[...] doesn't the many-to-many table name need to be in
alphabetic order as such: alphafirst_alphasecond, or areas_events.
That's correct.
Also, be aware that if you have an underscore (_) in a table name the
underscore comes AFTER alphabetic letters.
So:
images
I'm new to cake but doesn't the many-to-many table name need to be in
alphabetic order as such: alphafirst_alphasecond, or areas_events.
Maybe that will help :)
Z
Kenia wrote:
Hi.. i have a problem with the multiple select in a relationship
many-to-many...
my tables:
event
id_event
Any thoughts ??
how about adding this function to your app_controller.php
function getSelectedItems ($data)
{
$return = array();
foreach ($data as $row)
{
$return[$row['id']] = $row['name'];
}
You're definitely right. thanks a lot. I should think about it every
time I see something recurrent in my code.
Jon Bennett wrote:
Any thoughts ??
how about adding this function to your app_controller.php
function getSelectedItems ($data)
{
$return = array();
foreach
Hi Daniel,
For more information about the HTML helper and its functions refer to
the API or have a look at the inline documentation of the file html.php
(located in cake/libs/view/helpers).
Searching for the function selectTag supplies you with the following
comment:
/**
* Returns a formatted
Thanks.
I've only checked the manual, and I fount that it seemed to be for some
old edition of CakePHP.
There is no description of selectTag, only an example in the Saving
hasAndBelongsToMany.
The code is:?php echo $html-selectTag('Tag/Tag', $tags, null,
array('multiple' = 'multiple')) ?
Is
Cake is changing everyday, the manual will almost always lag behind the
development. This is why the inline documentation/API is more up to
date than the manual.
As Cake is no finished software, try not to rely on the manual alone,
but let the code and the API be your guide as well ;)
P.S.: The
PHP:
?php echo $html-selectTag('Tag/Tag', array(1,3,4), null,
array('multiple' = 'multiple'));?
Page Source:
select name=data[Tag][Tag][] multiple=multiple id=TagTag
option value= nbsp;/option
option value=0 selected=selected1/option
option value=1 3/option
option value=2 4/option
/select
Is there an elegant way to build the list of selected items to feed the $html-selectTag() in a HABTM relation ??I ended with for instance: $materials_selected_designations = array(); for($i=0; $i sizeof($this-params['data']['Material']); $i++){
Hi.. i have a problem with the multiple select in a relationship
many-to-many...
my tables:
event
id_event - int
name - varchar
areas
id_area- int
name - varchar
events_areas
area_id - int
event_id - int
then, i need to put in the multiple select the areas of the event: add,
show, delete
90 matches
Mail list logo