Re: $this->Form->create() and View blocks

2014-08-01 Thread Tiago Barrionuevo
Ok, I agree with you, in both points!

Thanks for your attention.


Em sexta-feira, 1 de agosto de 2014 11h52min22s UTC-3, José Lorenzo 
escreveu:
>
> I would suggest not breaking your forms across multiple blocks... and 
> don't think there will be a change around that in the FormHelper because of 
> the order the views are loaded when using blocks.
>
> On Friday, August 1, 2014 4:35:03 PM UTC+2, Tiago Barrionuevo wrote:
>>
>> In this case if I have to move the Form->create() out of this view I'll 
>> be doing code duplication in every form.
>>
>> The solution I found was create a method "setContext($context)" in a 
>> inherited Form helper to initialize before the Form->input() in the view 
>> block.
>>
>> Is there any chance this become functional this way in the future?
>>
>>
>> Em quinta-feira, 31 de julho de 2014 08h58min56s UTC-3, Tiago Barrionuevo 
>> escreveu:
>>>
>>> Yes, it returns an entity. I can simplify a little more:
>>>
>>>  
>>>
>>> 
>>> >>   echo $this->Form->create($test); 
>>>  echo $this->fetch('cadastro_data'); 
>>>echo $this->Form->end(); 
>>> ?> 
>>>
>>> 
>>>
>>> After some debugging I guess I found the problem!
>>> Cause "$this->Form->create($test)" is in other view that the " 
>>> $this->Form->input(...);", the Form->inputs are processed before the 
>>> Form->Create and it has no entity yet! 
>>>
>>>
>>> Em quinta-feira, 31 de julho de 2014 08h28min13s UTC-3, José Lorenzo 
>>> escreveu:

 What does $this->get('test') return? Is it an entity?

 On Thursday, July 31, 2014 3:47:47 AM UTC+2, Tiago Barrionuevo wrote:
>
> Hi,
>
> I'm trying to build a form, with a CakePHP 3 application, using view 
> blocks but I can't get it to work. It seens that the Form->create() 
> doesn't 
> find the model.
> I build a simple form to test it (controller Tests): 
>
>
> src/Template/Tests/view_block.ctp
>
>  $this->set('cadastro_title', $this->get('search_modulename') . ' - 
> VIEW_BLOCK');
> $this->set('cadastro_entity', $this->get('test'));
>
> $this->extend('/Common/cadastro_editor');
>
> $this->start('cadastro_data');
> ?>
>
> 
>   
> Form->input('id', array('label' => 'Id:' ));?>
>   
>
>   
> Form->input('name', array('label' => 'Name:' ));?>
>   
>
>   
> Form->input('result', array('label' => 'Result:' ));?>
>   
> 
>
> end(); ?>
>
>
> ---
> src/Template/Common/cadastro_editor.ctp
>
>  
>   get('cadastro_title'); ?> 
>  
>
>  echo $this->Form->create($this->get('test') ); 
> //echo $this->Form->create($this->get('cadastro_entity') ); 
>  
> echo $this->fetch('cadastro_data'); 
>  
>   echo $this->Form->end(); 
> ?> 
>
> 
>  
> ==
> The same form without view block works ok:
>
>  $this->set('cadastro_title', $this->get('search_modulename') . ' - 
> VIEW');
> ?>
> 
>   get('cadastro_title'); ?>
>
>   
>    echo $this->Form->create($this->get('test') );
> ?>
>
> 
>   
> Form->input('id', array('type'=>'text', 'label' => 
> 'Id:' ));?>
>   
>
>   
> Form->input('name', array('label' => 'Name:' ));?>
>   
>
>   
> Form->input('result', array('label' => 'Result:' 
> )); ?>
>   
> 
>   
> 
>
>
> Maybe I'm doing something wrong!
>
> Thanks in advance
>


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: $this->Form->create() and View blocks

2014-08-01 Thread José Lorenzo
I would suggest not breaking your forms across multiple blocks... and don't 
think there will be a change around that in the FormHelper because of the 
order the views are loaded when using blocks.

On Friday, August 1, 2014 4:35:03 PM UTC+2, Tiago Barrionuevo wrote:
>
> In this case if I have to move the Form->create() out of this view I'll be 
> doing code duplication in every form.
>
> The solution I found was create a method "setContext($context)" in a 
> inherited Form helper to initialize before the Form->input() in the view 
> block.
>
> Is there any chance this become functional this way in the future?
>
>
> Em quinta-feira, 31 de julho de 2014 08h58min56s UTC-3, Tiago Barrionuevo 
> escreveu:
>>
>> Yes, it returns an entity. I can simplify a little more:
>>
>>  
>>
>> 
>> >   echo $this->Form->create($test); 
>>  echo $this->fetch('cadastro_data'); 
>>echo $this->Form->end(); 
>> ?> 
>>
>> 
>>
>> After some debugging I guess I found the problem!
>> Cause "$this->Form->create($test)" is in other view that the " 
>> $this->Form->input(...);", the Form->inputs are processed before the 
>> Form->Create and it has no entity yet! 
>>
>>
>> Em quinta-feira, 31 de julho de 2014 08h28min13s UTC-3, José Lorenzo 
>> escreveu:
>>>
>>> What does $this->get('test') return? Is it an entity?
>>>
>>> On Thursday, July 31, 2014 3:47:47 AM UTC+2, Tiago Barrionuevo wrote:

 Hi,

 I'm trying to build a form, with a CakePHP 3 application, using view 
 blocks but I can't get it to work. It seens that the Form->create() 
 doesn't 
 find the model.
 I build a simple form to test it (controller Tests): 


 src/Template/Tests/view_block.ctp

 >>> $this->set('cadastro_title', $this->get('search_modulename') . ' - 
 VIEW_BLOCK');
 $this->set('cadastro_entity', $this->get('test'));

 $this->extend('/Common/cadastro_editor');

 $this->start('cadastro_data');
 ?>

 
   
 Form->input('id', array('label' => 'Id:' ));?>
   

   
 Form->input('name', array('label' => 'Name:' ));?>
   

   
 Form->input('result', array('label' => 'Result:' ));?>
   
 

 end(); ?>


 ---
 src/Template/Common/cadastro_editor.ctp

  
   get('cadastro_title'); ?> 
  

 >>> echo $this->Form->create($this->get('test') ); 
 //echo $this->Form->create($this->get('cadastro_entity') ); 
  
 echo $this->fetch('cadastro_data'); 
  
   echo $this->Form->end(); 
 ?> 

 
  
 ==
 The same form without view block works ok:

 >>> $this->set('cadastro_title', $this->get('search_modulename') . ' - 
 VIEW');
 ?>
 
   get('cadastro_title'); ?>

   
 >>>   echo $this->Form->create($this->get('test') );
 ?>

 
   
 Form->input('id', array('type'=>'text', 'label' => 
 'Id:' ));?>
   

   
 Form->input('name', array('label' => 'Name:' ));?>
   

   
 Form->input('result', array('label' => 'Result:' )); 
 ?>
   
 
   
 


 Maybe I'm doing something wrong!

 Thanks in advance

>>>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: $this->Form->create() and View blocks

2014-08-01 Thread Tiago Barrionuevo
In this case if I have to move the Form->create() out of this view I'll be 
doing code duplication in every form.

The solution I found was create a method "setContext($context)" in a 
inherited Form helper to initialize before the Form->input() in the view 
block.

Is there any chance this become functional this way in the future?


Em quinta-feira, 31 de julho de 2014 08h58min56s UTC-3, Tiago Barrionuevo 
escreveu:
>
> Yes, it returns an entity. I can simplify a little more:
>
>  
>
> 
>echo $this->Form->create($test); 
>  echo $this->fetch('cadastro_data'); 
>echo $this->Form->end(); 
> ?> 
>
> 
>
> After some debugging I guess I found the problem!
> Cause "$this->Form->create($test)" is in other view that the " 
> $this->Form->input(...);", the Form->inputs are processed before the 
> Form->Create and it has no entity yet! 
>
>
> Em quinta-feira, 31 de julho de 2014 08h28min13s UTC-3, José Lorenzo 
> escreveu:
>>
>> What does $this->get('test') return? Is it an entity?
>>
>> On Thursday, July 31, 2014 3:47:47 AM UTC+2, Tiago Barrionuevo wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to build a form, with a CakePHP 3 application, using view 
>>> blocks but I can't get it to work. It seens that the Form->create() doesn't 
>>> find the model.
>>> I build a simple form to test it (controller Tests): 
>>>
>>>
>>> src/Template/Tests/view_block.ctp
>>>
>>> >> $this->set('cadastro_title', $this->get('search_modulename') . ' - 
>>> VIEW_BLOCK');
>>> $this->set('cadastro_entity', $this->get('test'));
>>>
>>> $this->extend('/Common/cadastro_editor');
>>>
>>> $this->start('cadastro_data');
>>> ?>
>>>
>>> 
>>>   
>>> Form->input('id', array('label' => 'Id:' ));?>
>>>   
>>>
>>>   
>>> Form->input('name', array('label' => 'Name:' ));?>
>>>   
>>>
>>>   
>>> Form->input('result', array('label' => 'Result:' ));?>
>>>   
>>> 
>>>
>>> end(); ?>
>>>
>>>
>>> ---
>>> src/Template/Common/cadastro_editor.ctp
>>>
>>>  
>>>   get('cadastro_title'); ?> 
>>>  
>>>
>>> >> echo $this->Form->create($this->get('test') ); 
>>> //echo $this->Form->create($this->get('cadastro_entity') ); 
>>>  
>>> echo $this->fetch('cadastro_data'); 
>>>  
>>>   echo $this->Form->end(); 
>>> ?> 
>>>
>>> 
>>>  
>>> ==
>>> The same form without view block works ok:
>>>
>>> >> $this->set('cadastro_title', $this->get('search_modulename') . ' - 
>>> VIEW');
>>> ?>
>>> 
>>>   get('cadastro_title'); ?>
>>>
>>>   
>>> >>   echo $this->Form->create($this->get('test') );
>>> ?>
>>>
>>> 
>>>   
>>> Form->input('id', array('type'=>'text', 'label' => 
>>> 'Id:' ));?>
>>>   
>>>
>>>   
>>> Form->input('name', array('label' => 'Name:' ));?>
>>>   
>>>
>>>   
>>> Form->input('result', array('label' => 'Result:' )); 
>>> ?>
>>>   
>>> 
>>>   
>>> 
>>>
>>>
>>> Maybe I'm doing something wrong!
>>>
>>> Thanks in advance
>>>
>>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: $this->Form->create() and View blocks

2014-07-31 Thread Tiago Barrionuevo
Yes, it returns an entity. I can simplify a little more:

 
   

Form->create($test); 
 echo $this->fetch('cadastro_data'); 
   echo $this->Form->end(); 
?> 
   


After some debugging I guess I found the problem!
Cause "$this->Form->create($test)" is in other view that the " 
$this->Form->input(...);", the Form->inputs are processed before the 
Form->Create and it has no entity yet! 


Em quinta-feira, 31 de julho de 2014 08h28min13s UTC-3, José Lorenzo 
escreveu:
>
> What does $this->get('test') return? Is it an entity?
>
> On Thursday, July 31, 2014 3:47:47 AM UTC+2, Tiago Barrionuevo wrote:
>>
>> Hi,
>>
>> I'm trying to build a form, with a CakePHP 3 application, using view 
>> blocks but I can't get it to work. It seens that the Form->create() doesn't 
>> find the model.
>> I build a simple form to test it (controller Tests): 
>>
>>
>> src/Template/Tests/view_block.ctp
>>
>> > $this->set('cadastro_title', $this->get('search_modulename') . ' - 
>> VIEW_BLOCK');
>> $this->set('cadastro_entity', $this->get('test'));
>>
>> $this->extend('/Common/cadastro_editor');
>>
>> $this->start('cadastro_data');
>> ?>
>>
>> 
>>   
>> Form->input('id', array('label' => 'Id:' ));?>
>>   
>>
>>   
>> Form->input('name', array('label' => 'Name:' ));?>
>>   
>>
>>   
>> Form->input('result', array('label' => 'Result:' ));?>
>>   
>> 
>>
>> end(); ?>
>>
>>
>> ---
>> src/Template/Common/cadastro_editor.ctp
>>
>>  
>>   get('cadastro_title'); ?> 
>>  
>>
>> > echo $this->Form->create($this->get('test') ); 
>> //echo $this->Form->create($this->get('cadastro_entity') ); 
>>  
>> echo $this->fetch('cadastro_data'); 
>>  
>>   echo $this->Form->end(); 
>> ?> 
>>
>> 
>>  
>> ==
>> The same form without view block works ok:
>>
>> > $this->set('cadastro_title', $this->get('search_modulename') . ' - VIEW');
>> ?>
>> 
>>   get('cadastro_title'); ?>
>>
>>   
>> >   echo $this->Form->create($this->get('test') );
>> ?>
>>
>> 
>>   
>> Form->input('id', array('type'=>'text', 'label' => 
>> 'Id:' ));?>
>>   
>>
>>   
>> Form->input('name', array('label' => 'Name:' ));?>
>>   
>>
>>   
>> Form->input('result', array('label' => 'Result:' )); ?>
>>   
>> 
>>   
>> 
>>
>>
>> Maybe I'm doing something wrong!
>>
>> Thanks in advance
>>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: $this->Form->create() and View blocks

2014-07-31 Thread José Lorenzo
What does $this->get('test') return? Is it an entity?

On Thursday, July 31, 2014 3:47:47 AM UTC+2, Tiago Barrionuevo wrote:
>
> Hi,
>
> I'm trying to build a form, with a CakePHP 3 application, using view 
> blocks but I can't get it to work. It seens that the Form->create() doesn't 
> find the model.
> I build a simple form to test it (controller Tests): 
>
>
> src/Template/Tests/view_block.ctp
>
>  $this->set('cadastro_title', $this->get('search_modulename') . ' - 
> VIEW_BLOCK');
> $this->set('cadastro_entity', $this->get('test'));
>
> $this->extend('/Common/cadastro_editor');
>
> $this->start('cadastro_data');
> ?>
>
> 
>   
> Form->input('id', array('label' => 'Id:' ));?>
>   
>
>   
> Form->input('name', array('label' => 'Name:' ));?>
>   
>
>   
> Form->input('result', array('label' => 'Result:' ));?>
>   
> 
>
> end(); ?>
>
> ---
> src/Template/Common/cadastro_editor.ctp
>
>  
>   get('cadastro_title'); ?> 
>  
>
>  echo $this->Form->create($this->get('test') ); 
> //echo $this->Form->create($this->get('cadastro_entity') ); 
>  
> echo $this->fetch('cadastro_data'); 
>  
>   echo $this->Form->end(); 
> ?> 
>
> 
>  
> ==
> The same form without view block works ok:
>
>  $this->set('cadastro_title', $this->get('search_modulename') . ' - VIEW');
> ?>
> 
>   get('cadastro_title'); ?>
>
>   
>echo $this->Form->create($this->get('test') );
> ?>
>
> 
>   
> Form->input('id', array('type'=>'text', 'label' => 
> 'Id:' ));?>
>   
>
>   
> Form->input('name', array('label' => 'Name:' ));?>
>   
>
>   
> Form->input('result', array('label' => 'Result:' )); ?>
>   
> 
>   
> 
>
>
> Maybe I'm doing something wrong!
>
> Thanks in advance
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.