Form helper issue with euro symbol

2012-02-28 Thread Kro
Hi,
I have a form input which is taking in a rate title. This has worked
fine in the past but when a euro symbol is added to a title Cake
doesn't seem to be converting it to 'euro' as I would expect. The
core file, layout and database are all using utf-8 encoding. I'm just
wondering if there is some parameter I can add to the form input field
to force Cake to convert the euro before saving?
Any advice would be greatly appreciated...

-- 
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 related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


form helper issue for associated models inside and outside a plugin

2009-07-23 Thread maurozadu

We have a plugin (let’s name it “Cms”). This plugin has a model called
Image, used to add images to a model. The Image model is inside the
plugin; others models are, of course, outside (for example the “Page”
model). The relationship is made on the fly, with a code like this

$this-Page-bindModel(array('hasMany' = array('Cms.Image' = array
('foreignKey' = 'record_id';

We use Cms.Image because the bind must be donde like: Plugin.Model

Then we want to add a new page, so we write this code in the “add”
view

echo $form-create(array('type' = 'file'));
echo $form-input('Page.title');
echo $form-input('Page.content');
...etc

And now, here is the problem: ¿How do we write the input for the
Image?

If the Image model where outside the plugin, we would normally use:

echo $form-input('Image.0.name');

then in the controller we use the method saveAll, and everything is
smooth.

But the situation is different here, we have a model outside the
plugin (Page) which is associated with a model Inside the plugin
(Image)

My first attempt was to do this:

echo $form-input('Cms.Image.0.name');

but it fails! It generates an input with the attribute name=data[Cms]
[Image][0][name]

If I hardcode the input field with something like name=data[Cms.Image]
[0][name] everything works perfect (with validation and callbacks for
both models). But working in this way I have to do an extra job for
display error messages and I assume I would have some other issues if
I don’t use the form helper.

The second idea was:

echo $form-input('Image.0.name', array('plugin' = 'Cms'));

But it didn’t work either, because the input method in the form helper
doesn’t expect a plugin key in the options array and just ignore it. I
read the code of Form::input() and I found that the separation into
array keys by the point is made by a very parent classes, so I neither
could easily hack the core to find a solution.

What do yo think? Is there a way to solve this issue or the problem is
me misunderstanding something? (or everything maybe)

Thanks for the support!


--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Form Helper Issue

2008-04-16 Thread B3

Hi,

I recently noticed a weird issue regarding the form helper.

I have a model with 2 habtm associations - one of them being 'Local'.
So here's what I don't understand:

When using

$form-input('Local')

in an add/edit-form cake's rendering a multiple-select-box, which is
not my intention and also space-wasting but working great!
So I substituted that line with:

$form-input('Local', array('type' = 'select'))

Cake now renders the desired select-box, but when trying to save the
form I get following errors:

Warning (2): Invalid argument supplied for foreach() [CORE/cake/libs/
model/model.php, line 1284]
Warning (2): Cannot modify header information - headers already sent
by (output started at /path/to/cake/basics.php:338) [CORE/cake/libs/
controller/controller.php, line 546]

The association also doesn't get saved. I can imagine that my post-
data is corrupt when using the drop-down-box. Why's that?

--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Helper Issue

2008-04-16 Thread grigri

Read : http://book.cakephp.org/view/85/saving-related-model-data-habt

It describes the proper way to create a habtm form and save the
related data [especially the last sentence!].

Also, I'm not sure I understand about the multiple-select-box. You've
defined an assoiciation where `A` has and belongs to *many* `B`, but
you don't want the select box to be multiple? How does this work?

On Apr 16, 1:36 pm, B3 [EMAIL PROTECTED] wrote:
 Hi,

 I recently noticed a weird issue regarding the form helper.

 I have a model with 2 habtm associations - one of them being 'Local'.
 So here's what I don't understand:

 When using

 $form-input('Local')

 in an add/edit-form cake's rendering a multiple-select-box, which is
 not my intention and also space-wasting but working great!
 So I substituted that line with:

 $form-input('Local', array('type' = 'select'))

 Cake now renders the desired select-box, but when trying to save the
 form I get following errors:

 Warning (2): Invalid argument supplied for foreach() [CORE/cake/libs/
 model/model.php, line 1284]
 Warning (2): Cannot modify header information - headers already sent
 by (output started at /path/to/cake/basics.php:338) [CORE/cake/libs/
 controller/controller.php, line 546]

 The association also doesn't get saved. I can imagine that my post-
 data is corrupt when using the drop-down-box. Why's that?
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Helper Issue

2008-04-16 Thread Björn Biele

If I want to save the B's which have/belong to A one by one it is a  
proper solution not to use a multiple select box.

Finally i got the idea using:

$form-input('Local', array('multiple' = false))

could help and it worked!

The fact that using 'type' = 'select' is producing messed up data  
seems pretty weird though to me!


 Read : http://book.cakephp.org/view/85/saving-related-model-data-habt

 It describes the proper way to create a habtm form and save the
 related data [especially the last sentence!].

 Also, I'm not sure I understand about the multiple-select-box. You've
 defined an assoiciation where `A` has and belongs to *many* `B`, but
 you don't want the select box to be multiple? How does this work?

 On Apr 16, 1:36 pm, B3 [EMAIL PROTECTED] wrote:
 Hi,

 I recently noticed a weird issue regarding the form helper.

 I have a model with 2 habtm associations - one of them being 'Local'.
 So here's what I don't understand:

 When using

 $form-input('Local')

 in an add/edit-form cake's rendering a multiple-select-box, which is
 not my intention and also space-wasting but working great!
 So I substituted that line with:

 $form-input('Local', array('type' = 'select'))

 Cake now renders the desired select-box, but when trying to save the
 form I get following errors:

 Warning (2): Invalid argument supplied for foreach() [CORE/cake/libs/
 model/model.php, line 1284]
 Warning (2): Cannot modify header information - headers already sent
 by (output started at /path/to/cake/basics.php:338) [CORE/cake/libs/
 controller/controller.php, line 546]

 The association also doesn't get saved. I can imagine that my post-
 data is corrupt when using the drop-down-box. Why's that?
 


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Helper Issue

2008-04-16 Thread TechSteve

i think the reason why have this error is because of that
cake supposes the input is from a multiple-select-box, whose value is
an array, but not from a single-select-box (dorp-down-box), whose
value is a single string. so when cake tries to read elements from an
array but the feed is a string, the error occurs.
by default, as grigri said, cake thinks multi-select-box for the habtm
relation since you set that there may be many. if this relation is not
exactly as expected, i would change it if i were you since there may
be more extra database queries (costs) made based on this relation.

good luck!
Steve


On Apr 16, 6:11 am, Björn Biele [EMAIL PROTECTED] wrote:
 If I want to save the B's which have/belong to A one by one it is a
 proper solution not to use a multiple select box.

 Finally i got the idea using:

 $form-input('Local', array('multiple' = false))

 could help and it worked!

 The fact that using 'type' = 'select' is producing messed up data
 seems pretty weird though to me!

  Read :http://book.cakephp.org/view/85/saving-related-model-data-habt

  It describes the proper way to create a habtm form and save the
  related data [especially the last sentence!].

  Also, I'm not sure I understand about the multiple-select-box. You've
  defined an assoiciation where `A` has and belongs to *many* `B`, but
  you don't want the select box to be multiple? How does this work?

  On Apr 16, 1:36 pm, B3 [EMAIL PROTECTED] wrote:
  Hi,

  I recently noticed a weird issue regarding the form helper.

  I have a model with 2 habtm associations - one of them being 'Local'.
  So here's what I don't understand:

  When using

  $form-input('Local')

  in an add/edit-form cake's rendering a multiple-select-box, which is
  not my intention and also space-wasting but working great!
  So I substituted that line with:

  $form-input('Local', array('type' = 'select'))

  Cake now renders the desired select-box, but when trying to save the
  form I get following errors:

  Warning (2): Invalid argument supplied for foreach() [CORE/cake/libs/
  model/model.php, line 1284]
  Warning (2): Cannot modify header information - headers already sent
  by (output started at /path/to/cake/basics.php:338) [CORE/cake/libs/
  controller/controller.php, line 546]

  The association also doesn't get saved. I can imagine that my post-
  data is corrupt when using the drop-down-box. Why's that?
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form helper issue

2007-08-13 Thread [EMAIL PROTECTED]

In this case the URL with GET parameters is not readable at all :-).
For examle this is might be a result of search or filter form.

On Aug 13, 7:42 am, Grant Cox [EMAIL PROTECTED] wrote:
 It's intentional, for convenience.

 The simplest solution would be to use  $this-input('General.island_param')  
 and access the submitted data in $this-
 data['General']['island_param'].  It doesn't matter that General

 isn't a model.

 On Aug 13, 9:34 am, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  If I do echo $form-input('Model.id') and then echo 
  $form-input('island_param'), Cake is using Model to create the second one's

  attribute tags and assigning $this-data['Model']['island_param'] in
  the controller.why doesn't it put it in $this-data['island_param']? Is 
  this supposed to be a feature for

  convenience or is it a bug? Some of my form elements should not be
  classified as part of the Model.


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Form helper issue

2007-08-12 Thread [EMAIL PROTECTED]

If I do echo $form-input('Model.id') and then echo $form-
input('island_param'), Cake is using Model to create the second one's
attribute tags and assigning $this-data['Model']['island_param'] in
the controller.why doesn't it put it in $this-
data['island_param']? Is this supposed to be a feature for
convenience or is it a bug? Some of my form elements should not be
classified as part of the Model.


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form helper issue

2007-08-12 Thread Grant Cox

It's intentional, for convenience.

The simplest solution would be to use  $this-
input('General.island_param')  and access the submitted data in $this-
data['General']['island_param'].  It doesn't matter that General
isn't a model.


On Aug 13, 9:34 am, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 If I do echo $form-input('Model.id') and then echo 
 $form-input('island_param'), Cake is using Model to create the second one's

 attribute tags and assigning $this-data['Model']['island_param'] in
 the controller.why doesn't it put it in $this-data['island_param']? Is 
 this supposed to be a feature for

 convenience or is it a bug? Some of my form elements should not be
 classified as part of the Model.


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---