Saturday, January 26, 2013

Re: CakePHP 2.2.5 HABTM Edit view not showing previously selected values as selected.

//$this->request->data['ShippingMethod']

Array ( [0] => Array ( [id] => 1 [name] => Free Shipping [ProductShippingMethod] => Array ( [id] => 4 [product_id] => 18 [shipping_method_id] => 1 [created] => [modified] => ) ) [1] => Array ( [id] => 3 [name] => FedEx [ProductShippingMethod] => Array ( [id] => 6 [product_id] => 18 [shipping_method_id] => 3 [created] => [modified] => ) ) )
//$shippingMethods:

Array ( [1] => Free Shipping [2] => Delivery In Person [3] => FedEx ) 1

The above is  on the site on which it works.

This is for the site on which it does NOT work:


Array ( [0] => Array ( [id] => 1 [name] => Free Shipping [ProductsShippingMethod] => Array ( [id] => 1 [product_id] => 1 [shipping_method_id] => 1 ) ) [1] => Array ( [id] => 2 [name] => Delivery In Person [ProductsShippingMethod] => Array ( [id] => 2 [product_id] => 1 [shipping_method_id] => 2 ) ) [2] => Array ( [id] => 3 [name] => FedEx [ProductsShippingMethod] => Array ( [id] => 3 [product_id] => 1 [shipping_method_id] => 3 ) ) )
Array ( [1] => Free Shipping [2] => Delivery In Person [3] => FedEx ) 1

As you can see, no actual difference, except the missing created/modified fields. and the naming of the hasandbelongstomany alias on the one that works, which is 'Shipping'.

Not even to mention that the working one doesn't respect the naming convention, and i've manually specified the join table's name, compared to the one that DOES NOT work, which respects it all.



Regards,

Alex.

Thanks, i really appreciate all this help, as this is the weirdest issue i've had.


On Sunday, January 27, 2013 4:46:26 AM UTC+2, ibejohn818 wrote:
print_r your request data and ensure that the schema is matching your intended inputs

==
print_r($this->request->data);
==



On Jan 26, 2013, at 6:42 PM, Penny Coders <dtk...@gmail.com> wrote:

Please note, it DOES show the options, but NOT the previously selected values, compared to another site, on exactly the same procedure does work...

On Sunday, January 27, 2013 4:41:46 AM UTC+2, Penny Coders wrote:
Hey,

Thanks, i did try that, no luck tho' 

Anybody any more ideas?

Best Regards,

Alex.

On Saturday, January 26, 2013 9:49:52 PM UTC+2, cricket wrote:
On Fri, Jan 25, 2013 at 8:03 PM, Penny Coders <dtk...@gmail.com> wrote:

<?php echo $this->Form->input('ShippingMethod',array('label'=>false,'multiple'=>'multiple','class'=>'chzn-select validate[required]','div'=>false,'data-placeholder'=>'Shipping methods'));?>

You've specified the model but not the key.

$this->Form->input('ShippingMethod.id', ... 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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 cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: