Weird problem with Form Helper and cache

2013-12-06 Thread HK
I use cake some years now from v1.2 I will write down a problem I had just to share it with you and find out whether it's a bug or not. In my app controller in beforeFilter I have: > if (($newarticles = Cache::read('newarticles', 'short')) == null) > > { > > $this->loadModel('Article'

Re: Strange problem with form helper...

2010-08-17 Thread Zippoxer
Okay it works, the problem was that I wrote: print_r($this->data) in an action instead of in beforeFilter()... On Aug 17, 7:57 pm, Zippoxer wrote: > Tried more tons of things, nothing works... :\ > > On Aug 17, 2:47 pm, Zippoxer wrote: > > > > > Still the same. > > After submiting the login form

Re: Strange problem with form helper...

2010-08-17 Thread Zippoxer
Tried more tons of things, nothing works... :\ On Aug 17, 2:47 pm, Zippoxer wrote: > Still the same. > After submiting the login form with test_username/test_password, here > is print_r($this->data): > Array ( [Player] => Array ( [name] => test_username [password] => ) ) > > I noticed that even i

Re: Strange problem with form helper...

2010-08-17 Thread Zippoxer
Still the same. After submiting the login form with test_username/test_password, here is print_r($this->data): Array ( [Player] => Array ( [name] => test_username [password] => ) ) I noticed that even if I remove the password field form the form, print_r($this->data) is exactly the same (with 'pas

Re: Strange problem with form helper...

2010-08-17 Thread Brendan Farquharson
Try enabling 'Session' component as well in your app_controller.php On 17 August 2010 12:01, Zippoxer wrote: > No that's not the problem. The Auth component is enabled. > Please what's the problem? I'm waiting two days and can't keep working > with CakePHP... > > On Aug 16, 9:37 pm, Zippoxer w

Re: Strange problem with form helper...

2010-08-17 Thread Zippoxer
No that's not the problem. The Auth component is enabled. Please what's the problem? I'm waiting two days and can't keep working with CakePHP... On Aug 16, 9:37 pm, Zippoxer wrote: > Ohh, I think that's the problem. It looks enabled, but when I don't > allow access to "login" action it still allo

Re: Strange problem with form helper...

2010-08-16 Thread Zippoxer
Ohh, I think that's the problem. It looks enabled, but when I don't allow access to "login" action it still allows. Here's the full app_controller.php code: class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { parent::beforeFilter();

Re: Strange problem with form helper...

2010-08-16 Thread Zippoxer
That's how my app_controller.php begins: class AppController extends Controller { var $components = array('Auth'); On Aug 16, 9:13 pm, Miles J wrote: > Do you have the Auth component enabled? > > On Aug 16, 2:04 am, Zippoxer wrote: > > > > > This is the form code in the view: > > >     ech

Re: Strange problem with form helper...

2010-08-16 Thread Miles J
Do you have the Auth component enabled? On Aug 16, 2:04 am, Zippoxer wrote: > This is the form code in the view: >     echo $form->create('Player'); >     echo $form->input('name', array('label' => 'Name')); >     echo $form->input('password', array('label' => 'Password')); >     echo $form->end

Re: Strange problem with form helper...

2010-08-16 Thread Zippoxer
This is the form code in the view: create('Player'); echo $form->input('name', array('label' => 'Name')); echo $form->input('password', array('label' => 'Password')); echo $form->end('Login'); ?> And in the controller I just do: print_r($this->data); Then I see an array with the usern

Re: Strange problem with form helper...

2010-08-15 Thread Sam
We need more info... can you paste your view, and perhaps your controller action? On Aug 15, 1:24 pm, Zippoxer wrote: > I've created a simple authentication form with username and password > input fields. > The problem is that the password is always empty through $this->data > in the controller,

Strange problem with form helper...

2010-08-15 Thread Zippoxer
I've created a simple authentication form with username and password input fields. The problem is that the password is always empty through $this->data in the controller, but username is not empty. What's the problem? Check out the new CakePHP Questions site http://cakeqs.org and help others with

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
teknoid wrote: > That being said it is always a good idea to name your fields as > ModelName.fieldName and ModelName.{$index}.fieldName > This is especially true when using saveAll(), and I do specify that in > the tutorials. Yep, you're right. I usually do it that way when handling hasMany rela

Re: Problem with form helper

2008-09-25 Thread teknoid
I believe there is a documented issue that when you attempt to start a form name with a '0' it is not treated correctly (rather as null). That being said it is always a good idea to name your fields as ModelName.fieldName and ModelName.{$index}.fieldName This is especially true when using saveAll

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
Yep, I read those tutorials too, and it looks like it should work. A bit strange... grigri schrieb: > Sorry, I misinterpreted the setting. > > I was using this on a hasMany edit page,so it's not exactly the same > structure. > > (Page hasMany Section, this was for editing the Sections). > > I

Re: Problem with form helper

2008-09-25 Thread grigri
Sorry, I misinterpreted the setting. I was using this on a hasMany edit page,so it's not exactly the same structure. (Page hasMany Section, this was for editing the Sections). I just tried on a direct multi-model edit page, and ran into problems just like you said. However, in these tutorials:

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
I want to edit multiple records in one view. Controller: $this->data = $this->Contact->find('all', array( 'conditions' => array( 'Contact.user_id' => $this->Session->read('Auth.User.id') )); View (simplified): for ($i = 0; $i < count($this->data); $i++): e($form->input("$i.Contact.nam

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
Could you please post your controller code to populate the form? grigri schrieb: > I've never seen it done that way before. I always do it like this: > > (simplified view) > $n = empty($this->data['Contact']) ? 0 : count($this- >> data['Contact']); > for ($i = 0; $i<$n; $i++) { > echo $form->i

Re: Problem with form helper

2008-09-25 Thread grigri
I've never seen it done that way before. I always do it like this: (simplified view) $n = empty($this->data['Contact']) ? 0 : count($this- >data['Contact']); for ($i = 0; $i<$n; $i++) { echo $form->input("Contact.$i.name"); } This way the data is like this: $data = array( 'Contact' => array

Re: Problem with form helper

2008-09-25 Thread Günther Theilen
Donkeybob schrieb: > what happens when you do it the other way . . . That doesn't work at all. I think I'll just capitulate an do it the old fashioned way: index.ctp to list the records, edit.ctp to edit _one_ record Thanks anyway! Regards Guenther --~--~-~--~~~---

Re: Problem with form helper

2008-09-25 Thread Donkeybob
what happens when you do it the other way . . . in controller . . .. . . . $contacts = $this->Contact->find('all', array( 'conditions' => array( 'Contact.user_id' => $this->Session->read('Auth.User.id') )); $this->set('contacts', $contacts); in view . . . . foreach($contacts as $contact

Re: Problem with form helper

2008-09-25 Thread Donkeybob
Why would you be using an array integer instead of the model name? Does this not use a model? Code you post you controller code that populates this form? On Sep 25, 8:54 am, Günther Theilen <[EMAIL PROTECTED]> wrote: > Hi! > > I've got a weird problem with the form helper, maybe someone can help.

Problem with form helper

2008-09-25 Thread Günther Theilen
Hi! I've got a weird problem with the form helper, maybe someone can help... $form->input("5.name") creates an input field with name="data[5][name]", which is pretty much what I expected. But $form->input("0.name") creates an input field with name="data[foo][name]", foo is the pluralized mode