RE: form data

2014-05-24 Thread Advantage+
Perhaps read the Cookbook on data handling and how to access and use it.

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of 
Andrew Barry
Sent: Saturday, May 24, 2014 6:02 AM
To: cake-php@googlegroups.com
Subject: form data

 

Hi,

I created a form and a submit button.
After that I want to 
1) display certain fields back to another view  and that means the posted data 
is handled by the controller?
I am really finding this hard to get a complete example on this and cakephp 
book isnt helping as yet.

echo $this-Form-create();

echo $this-Form-input('username');   //text
echo $this-Form-input('password');   //password
echo $this-Form-input('birth_dt', 
   array('label' = 'Date of birth',
  'dateFormat' = 'DMY',
  'minYear' = date('Y') - 70,
  'maxYear' = date('Y') - 18));   
 echo $this-Form-checkbox('done');
echo $this-Form-input('field', array(
'options' = array(1, 2, 3, 4, 5),
'empty' = '(choose one)'));
echo $this-Form-end('submit');

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

-- 
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: form data

2014-05-24 Thread Advantage+
I also want to build the next best social media website can you tell me 
how. 

I just want you to do it for me and not do any of the work myself J

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of 
Andrew Barry
Sent: Saturday, May 24, 2014 6:02 AM
To: cake-php@googlegroups.com
Subject: form data

 

Hi,

I created a form and a submit button.
After that I want to 
1) display certain fields back to another view  and that means the posted data 
is handled by the controller?
I am really finding this hard to get a complete example on this and cakephp 
book isnt helping as yet.

echo $this-Form-create();

echo $this-Form-input('username');   //text
echo $this-Form-input('password');   //password
echo $this-Form-input('birth_dt', 
   array('label' = 'Date of birth',
  'dateFormat' = 'DMY',
  'minYear' = date('Y') - 70,
  'maxYear' = date('Y') - 18));   
 echo $this-Form-checkbox('done');
echo $this-Form-input('field', array(
'options' = array(1, 2, 3, 4, 5),
'empty' = '(choose one)'));
echo $this-Form-end('submit');

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

-- 
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: form data

2014-05-24 Thread Andrew Barry
Ok I was hoping I wouldnt get such a response.

I have been looking at this book and you have to admit , it just isnt 
always going to help you do a complete example.

data goes back to the controller in a 

$this-request-data['MyModel']['title']; and this means I can do what and 
where ? is there an example anywhere?


http://book.cakephp.org/2.0/en/controllers/request-response.html  //this 
doesnt help

-- 
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: form data

2014-05-24 Thread Advantage+
And show your code to show you made an effort.

We cannot see what your looking at.

 

What have you tried, what was the response, your model / controllers. Your 
trying to do what and this is where your at after doing? Error logs say what?

 

We cant help if you don’t put in the effort yourself.

 

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of 
Andrew Barry
Sent: Saturday, May 24, 2014 6:31 AM
To: cake-php@googlegroups.com
Subject: Re: form data

 

Ok I was hoping I wouldnt get such a response.

I have been looking at this book and you have to admit , it just isnt always 
going to help you do a complete example.

data goes back to the controller in a 

$this-request-data['MyModel']['title']; and this means I can do what and 
where ? is there an example anywhere?



http://book.cakephp.org/2.0/en/controllers/request-response.html  //this doesnt 
help

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

-- 
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: form data

2014-05-24 Thread Andrew Barry
what happens is that the form in  myform2 displays but the id fields are 
blank dropdown.
These fields are not autoincrement.
I submit and I can get the subject field displayed in myform3 but not id or 
date fields.




controller
public  function myform3()
{
   
   if($this-request-is('post')) {
$this-set('tutorInput', $this-request-data);
}
}



myform2 view
   echo $this-Form-create(array('action' = 'myform3'));
echo $this-Form-input('teacher_id');   //text
echo $this-Form-input('student_id');   //text
 echo $this-Form-input('subject');   //text
echo $this-Form-input('sessiondate', 
   array('label' = 'Session'));  
echo $this-Form-input('sessiontime', 
   array('label' = 'time'));  
 echo $this-Form-input('available');  
  echo $this-Form-end('submit'); 
 
myform3 view

  echo 'td'. $tutorInput['Tutorsession']['subject'].'/td';
   echo 'td'. $tutorInput['Tutorsession']['sessiondate'].'/td';
 echo 'td'. $tutorInput['Tutorsession']['student_id'].'/td';
   echo 'td'. $tutorInput['Tutorsession']['sessiontime'].'/td';
 echo '/trbr/';
   

-- 
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: Form data will not save in DB!

2009-05-07 Thread arif hossen
Please follow this code:
if your model name Tax (Model name must be table names singular number)

$this-data['Tax']['feildname'];

$this-Tax-save($this-data);




On Thu, May 7, 2009 at 7:56 AM, Dr. Loboto drlob...@gmail.com wrote:


 Key in data array should be same as model alias. If your model named
 Tax it have same alias Tax by default and require $this-data['Tax']
 ['feildname'].

 On May 7, 2:41 am, paul...@gmail.com paul...@gmail.com wrote:
  I have a table taxes and I'm using the form helper and it is putting
  the form data into an array $this-data['Taxis']['feildname'].  The
  problem is that when I call $this-Tax-save($this-data)); the insert
  sql statement doesn't have any of the values that was submitted via
  the form.
 
  Any ideas on what's going on and how to fix the issue?
 
  Thanks,
  jay
 
  P.S. using cakephp 1.2
 



-- 
Regards,
Mohammad Arif Hossen
Junior Web Developer
United Group International(UGIBD)
Mobile: +88 01714355911

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Form data will not save in DB!

2009-05-06 Thread Dr. Loboto

Key in data array should be same as model alias. If your model named
Tax it have same alias Tax by default and require $this-data['Tax']
['feildname'].

On May 7, 2:41 am, paul...@gmail.com paul...@gmail.com wrote:
 I have a table taxes and I'm using the form helper and it is putting
 the form data into an array $this-data['Taxis']['feildname'].  The
 problem is that when I call $this-Tax-save($this-data)); the insert
 sql statement doesn't have any of the values that was submitted via
 the form.

 Any ideas on what's going on and how to fix the issue?

 Thanks,
 jay

 P.S. using cakephp 1.2
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Form data from a view element

2008-09-18 Thread Daniel

Hi Luenyar,

I changed the form create line to:

?php echo $form-create('Comment', array('action' = 'add', 'url' =
array('controller' = 'comments', 'action' = 'add'))); ?

And when I submit the element form it _does_ send me to the right
url, that is /comments/add which is the right controller, but it still
says 0 query took ms and doesn't spew any of the debugging info that
I put in the add() function of the Comments controller.

I'm beginning to think the problem is handing the data off to the
controller. With the debug for cake set in core.php to FULL debug
(i.e. with controller info). I get NO controller information spewed.

Any more ideas? II've been working at this since before the
original post with no progress to a solution :(

- Dan

On Sep 17, 10:12 pm, Luenyar [EMAIL PROTECTED] wrote:
 $form-create('Comment') associates the form with the 'Comment' model,
 but not a controller.  Presumably because the 'Comments' model could
 be used in many or all of your controllers with $uses.  The 'action'
 option assumes the current controller, so if you render your element
 in the Posts controller, the action is assumed /posts/add.  url is the
 option you are looking for.

 http://manual.cakephp.org/view/183/Creating-Forms#options-url-186

 Hope that helps,
 Milton

 On Sep 16, 11:31 am, Daniel [EMAIL PROTECTED] wrote:

  I created the form using the line:

  $form-create('Comment', array('action' = 'add'));

  Doesn't this specify that it should use the controller associated with
  the Comment model, i.e. the Comments controller? This is how I've
  done it with all of my other forms...

  And yes, I realize the table based layout is terrible, I'm just
  mocking things at the moment and didn't want to write a stylesheet to
  position things yet.

  Thanks!

  - Dan

  On Sep 16, 11:23 am, mark_story [EMAIL PROTECTED] wrote:

   On Sep 16, 9:11 am, Daniel [EMAIL PROTECTED] wrote:

Hello,

     I currently have a comment box view element that I plan to
embed in various places in my CakePHP application to allow users to
leave comments on various aspects of the site.

     I'm using the form helper inside of the element to generate the
form to be used to submit the data, however when I submit the data I
receive only a blank screen that says 0 query took ms. I've even
added debugging echoes to the controller to print the data array and
I'm still just receiving a blank page with 0 query took ms.

     Attached below is the comment add method and the respective
element code.

     Any help anyone can provide would be greatly appreciated, I seem
to be pretty stuck!

Controller code:

function add()
{
    echo ;
    $mrClean = new Sanitize();

    echo Data . $this-data;

    if(!empty($this-data))
        {
                $mrClean-clean($this-data);

                $currUser = $this-get_current_user();
                $this-data['Comment']['user_id'] = $currUser['id'];
                $this-data['Comment']['isDeleted'] = 0;

                $targetEvent = $this-Event-find(first,
                  array('conditions' = array('Event.id' = 
$this-data['Comment']
['event_id']),
                                'recursive' = 1));

                print_r($targetEvent);

                if(empty($targetEvent) || is_null($targetEvent))
                {
                  $this-Comment-invalidate('event_id', 'You have 
selected an
invalid event.');
                  return;
                }

                if($this-Comment-save($this-data))
                {
                        $this-flash('Your comment has been added',
                                '/events/view/'. 
$this-data['Comment']['event_id']);
                } else {
                        $this-flash('An error has occured adding your 
comment.', '/
events');
                }
        }

}

Element code:

?php echo $form-create('Comment', array('action' = 'add')); ?
table class=commentsTable
tr
                td colspan='99' class='commentSubject'
                        Subject: nbsp;?php echo 
$form-input('subject', array( 'label' =
false )); ?
                /td
        /tr
        tr
                tdnbsp;/td
                td class='commentBody'
                        ?php echo $form-textarea('body',
                                array( 'label' = false,
                                           'rows' = 7,
                                           'cols' = 80 )); ?
                /td
        /tr
        tr
                td colspan='99' class='commentSubmit'
                        ?php echo $form-submit('Post Comment'); ?
                /td
        /tr
/table
?php echo $form-hidden('event_id', 

Re: Form data from a view element

2008-09-18 Thread Daniel

Just to add more information:

It seems that beforeFilter() is called in my comments controller but
something goes wrong before afterFilter() is called...

I'm trying to spelunk my way through the cakePHP code to see if I can
find a reason for this

- Dan

On Sep 18, 11:39 am, Daniel [EMAIL PROTECTED] wrote:
 Hi Luenyar,

     I changed the form create line to:

 ?php echo $form-create('Comment', array('action' = 'add', 'url' =
 array('controller' = 'comments', 'action' = 'add'))); ?

     And when I submit the element form it _does_ send me to the right
 url, that is /comments/add which is the right controller, but it still
 says 0 query took ms and doesn't spew any of the debugging info that
 I put in the add() function of the Comments controller.

     I'm beginning to think the problem is handing the data off to the
 controller. With the debug for cake set in core.php to FULL debug
 (i.e. with controller info). I get NO controller information spewed.

     Any more ideas? II've been working at this since before the
 original post with no progress to a solution :(

 - Dan

 On Sep 17, 10:12 pm, Luenyar [EMAIL PROTECTED] wrote:

  $form-create('Comment') associates the form with the 'Comment' model,
  but not a controller.  Presumably because the 'Comments' model could
  be used in many or all of your controllers with $uses.  The 'action'
  option assumes the current controller, so if you render your element
  in the Posts controller, the action is assumed /posts/add.  url is the
  option you are looking for.

 http://manual.cakephp.org/view/183/Creating-Forms#options-url-186

  Hope that helps,
  Milton

  On Sep 16, 11:31 am, Daniel [EMAIL PROTECTED] wrote:

   I created the form using the line:

   $form-create('Comment', array('action' = 'add'));

   Doesn't this specify that it should use the controller associated with
   the Comment model, i.e. the Comments controller? This is how I've
   done it with all of my other forms...

   And yes, I realize the table based layout is terrible, I'm just
   mocking things at the moment and didn't want to write a stylesheet to
   position things yet.

   Thanks!

   - Dan

   On Sep 16, 11:23 am, mark_story [EMAIL PROTECTED] wrote:

On Sep 16, 9:11 am, Daniel [EMAIL PROTECTED] wrote:

 Hello,

      I currently have a comment box view element that I plan to
 embed in various places in my CakePHP application to allow users to
 leave comments on various aspects of the site.

      I'm using the form helper inside of the element to generate the
 form to be used to submit the data, however when I submit the data I
 receive only a blank screen that says 0 query took ms. I've even
 added debugging echoes to the controller to print the data array and
 I'm still just receiving a blank page with 0 query took ms.

      Attached below is the comment add method and the respective
 element code.

      Any help anyone can provide would be greatly appreciated, I seem
 to be pretty stuck!

 Controller code:

 function add()
 {
     echo ;
     $mrClean = new Sanitize();

     echo Data . $this-data;

     if(!empty($this-data))
         {
                 $mrClean-clean($this-data);

                 $currUser = $this-get_current_user();
                 $this-data['Comment']['user_id'] = $currUser['id'];
                 $this-data['Comment']['isDeleted'] = 0;

                 $targetEvent = $this-Event-find(first,
                   array('conditions' = array('Event.id' = 
 $this-data['Comment']
 ['event_id']),
                                 'recursive' = 1));

                 print_r($targetEvent);

                 if(empty($targetEvent) || is_null($targetEvent))
                 {
                   $this-Comment-invalidate('event_id', 'You have 
 selected an
 invalid event.');
                   return;
                 }

                 if($this-Comment-save($this-data))
                 {
                         $this-flash('Your comment has been added',
                                 '/events/view/'. 
 $this-data['Comment']['event_id']);
                 } else {
                         $this-flash('An error has occured adding 
 your comment.', '/
 events');
                 }
         }

 }

 Element code:

 ?php echo $form-create('Comment', array('action' = 'add')); ?
 table class=commentsTable
 tr
                 td colspan='99' class='commentSubject'
                         Subject: nbsp;?php echo 
 $form-input('subject', array( 'label' =
 false )); ?
                 /td
         /tr
         tr
                 tdnbsp;/td
                 td class='commentBody'
                         ?php echo $form-textarea('body',
                                 array( 

Re: Form data from a view element

2008-09-17 Thread Luenyar

$form-create('Comment') associates the form with the 'Comment' model,
but not a controller.  Presumably because the 'Comments' model could
be used in many or all of your controllers with $uses.  The 'action'
option assumes the current controller, so if you render your element
in the Posts controller, the action is assumed /posts/add.  url is the
option you are looking for.

http://manual.cakephp.org/view/183/Creating-Forms#options-url-186

Hope that helps,
Milton

On Sep 16, 11:31 am, Daniel [EMAIL PROTECTED] wrote:
 I created the form using the line:

 $form-create('Comment', array('action' = 'add'));

 Doesn't this specify that it should use the controller associated with
 the Comment model, i.e. the Comments controller? This is how I've
 done it with all of my other forms...

 And yes, I realize the table based layout is terrible, I'm just
 mocking things at the moment and didn't want to write a stylesheet to
 position things yet.

 Thanks!

 - Dan

 On Sep 16, 11:23 am, mark_story [EMAIL PROTECTED] wrote:

  On Sep 16, 9:11 am, Daniel [EMAIL PROTECTED] wrote:

   Hello,

I currently have a comment box view element that I plan to
   embed in various places in my CakePHP application to allow users to
   leave comments on various aspects of the site.

I'm using the form helper inside of the element to generate the
   form to be used to submit the data, however when I submit the data I
   receive only a blank screen that says 0 query took ms. I've even
   added debugging echoes to the controller to print the data array and
   I'm still just receiving a blank page with 0 query took ms.

Attached below is the comment add method and the respective
   element code.

Any help anyone can provide would be greatly appreciated, I seem
   to be pretty stuck!

   Controller code:

   function add()
   {
   echo ;
   $mrClean = new Sanitize();

   echo Data . $this-data;

   if(!empty($this-data))
   {
   $mrClean-clean($this-data);

   $currUser = $this-get_current_user();
   $this-data['Comment']['user_id'] = $currUser['id'];
   $this-data['Comment']['isDeleted'] = 0;

   $targetEvent = $this-Event-find(first,
 array('conditions' = array('Event.id' = 
   $this-data['Comment']
   ['event_id']),
   'recursive' = 1));

   print_r($targetEvent);

   if(empty($targetEvent) || is_null($targetEvent))
   {
 $this-Comment-invalidate('event_id', 'You have 
   selected an
   invalid event.');
 return;
   }

   if($this-Comment-save($this-data))
   {
   $this-flash('Your comment has been added',
   '/events/view/'. 
   $this-data['Comment']['event_id']);
   } else {
   $this-flash('An error has occured adding your 
   comment.', '/
   events');
   }
   }

   }

   Element code:

   ?php echo $form-create('Comment', array('action' = 'add')); ?
   table class=commentsTable
   tr
   td colspan='99' class='commentSubject'
   Subject: nbsp;?php echo $form-input('subject', 
   array( 'label' =
   false )); ?
   /td
   /tr
   tr
   tdnbsp;/td
   td class='commentBody'
   ?php echo $form-textarea('body',
   array( 'label' = false,
  'rows' = 7,
  'cols' = 80 )); ?
   /td
   /tr
   tr
   td colspan='99' class='commentSubmit'
   ?php echo $form-submit('Post Comment'); ?
   /td
   /tr
   /table
   ?php echo $form-hidden('event_id', array('value' = $event_id)); ?
   ?php echo $form-end(); ?

  Your form doesn't have a controller?  how will it know what controller
  it is supposed to submit to.  I would double check that you are being
  sent to the right URL when submitting the form.  Also tables for
  layout make babies cry :)

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



Re: Form data from a view element

2008-09-16 Thread David C. Zentgraf

It doesn't matter whether your form comes from an element or a view  
file, it's generating the same HTML in the end, so check that first.
If the form/controller doesn't work it's not a problem of the element.

I'd guess that one of your problems is that you want to redirect as  
the final action of processing the data, but you're already echoing a  
lot of stuff before, so the redirect will fail.

As a side note, you don't need to instantiate Sanitize, you can call  
it statically like Sanitize::clean($data);

On 16 Sep 2008, at 22:11, Daniel wrote:


 Hello,

 I currently have a comment box view element that I plan to
 embed in various places in my CakePHP application to allow users to
 leave comments on various aspects of the site.

 I'm using the form helper inside of the element to generate the
 form to be used to submit the data, however when I submit the data I
 receive only a blank screen that says 0 query took ms. I've even
 added debugging echoes to the controller to print the data array and
 I'm still just receiving a blank page with 0 query took ms.

 Attached below is the comment add method and the respective
 element code.

 Any help anyone can provide would be greatly appreciated, I seem
 to be pretty stuck!


 Controller code:

 function add()
 {
echo ;
$mrClean = new Sanitize();

echo Data . $this-data;

if(!empty($this-data))
   {
   $mrClean-clean($this-data);

   $currUser = $this-get_current_user();
   $this-data['Comment']['user_id'] = $currUser['id'];
   $this-data['Comment']['isDeleted'] = 0;

   $targetEvent = $this-Event-find(first,
 array('conditions' = array('Event.id' = 
 $this-data['Comment']
 ['event_id']),
   'recursive' = 1));

   print_r($targetEvent);

   if(empty($targetEvent) || is_null($targetEvent))
   {
 $this-Comment-invalidate('event_id', 'You have selected an
 invalid event.');
 return;
   }

   if($this-Comment-save($this-data))
   {
   $this-flash('Your comment has been added',
   '/events/view/'. 
 $this-data['Comment']['event_id']);
   } else {
   $this-flash('An error has occured adding your 
 comment.', '/
 events');
   }
   }
 }


 Element code:

 ?php echo $form-create('Comment', array('action' = 'add')); ?
 table class=commentsTable
 tr
   td colspan='99' class='commentSubject'
   Subject: nbsp;?php echo $form-input('subject', 
 array( 'label' =
 false )); ?
   /td
   /tr
   tr
   tdnbsp;/td
   td class='commentBody'
   ?php echo $form-textarea('body',
   array( 'label' = false,
  'rows' = 7,
  'cols' = 80 )); ?
   /td
   /tr
   tr
   td colspan='99' class='commentSubmit'
   ?php echo $form-submit('Post Comment'); ?
   /td
   /tr
 /table
 ?php echo $form-hidden('event_id', array('value' = $event_id)); ?
 ?php echo $form-end(); ?

 


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



Re: Form data from a view element

2008-09-16 Thread mark_story

On Sep 16, 9:11 am, Daniel [EMAIL PROTECTED] wrote:
 Hello,

  I currently have a comment box view element that I plan to
 embed in various places in my CakePHP application to allow users to
 leave comments on various aspects of the site.

  I'm using the form helper inside of the element to generate the
 form to be used to submit the data, however when I submit the data I
 receive only a blank screen that says 0 query took ms. I've even
 added debugging echoes to the controller to print the data array and
 I'm still just receiving a blank page with 0 query took ms.

  Attached below is the comment add method and the respective
 element code.

  Any help anyone can provide would be greatly appreciated, I seem
 to be pretty stuck!

 Controller code:

 function add()
 {
 echo ;
 $mrClean = new Sanitize();

 echo Data . $this-data;

 if(!empty($this-data))
 {
 $mrClean-clean($this-data);

 $currUser = $this-get_current_user();
 $this-data['Comment']['user_id'] = $currUser['id'];
 $this-data['Comment']['isDeleted'] = 0;

 $targetEvent = $this-Event-find(first,
   array('conditions' = array('Event.id' = 
 $this-data['Comment']
 ['event_id']),
 'recursive' = 1));

 print_r($targetEvent);

 if(empty($targetEvent) || is_null($targetEvent))
 {
   $this-Comment-invalidate('event_id', 'You have selected an
 invalid event.');
   return;
 }

 if($this-Comment-save($this-data))
 {
 $this-flash('Your comment has been added',
 '/events/view/'. 
 $this-data['Comment']['event_id']);
 } else {
 $this-flash('An error has occured adding your 
 comment.', '/
 events');
 }
 }

 }

 Element code:

 ?php echo $form-create('Comment', array('action' = 'add')); ?
 table class=commentsTable
 tr
 td colspan='99' class='commentSubject'
 Subject: nbsp;?php echo $form-input('subject', 
 array( 'label' =
 false )); ?
 /td
 /tr
 tr
 tdnbsp;/td
 td class='commentBody'
 ?php echo $form-textarea('body',
 array( 'label' = false,
'rows' = 7,
'cols' = 80 )); ?
 /td
 /tr
 tr
 td colspan='99' class='commentSubmit'
 ?php echo $form-submit('Post Comment'); ?
 /td
 /tr
 /table
 ?php echo $form-hidden('event_id', array('value' = $event_id)); ?
 ?php echo $form-end(); ?

Your form doesn't have a controller?  how will it know what controller
it is supposed to submit to.  I would double check that you are being
sent to the right URL when submitting the form.  Also tables for
layout make babies cry :)

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



Re: Form data not available in controller

2008-04-28 Thread zendrumz

Well, I tried all your suggestions over the weekend, and none of them
panned out. count($_POST) tells me the post array is empty, and
likewise there is nothing in $this-params['form'] or $this-data. So
thanks for the help, but I now suspect the problem lies in my Apache
rewrite rules. The site is in a shared hosting environment, and the
DocumentRoot directive is not enabled, so I had to write a more
complex rewrite rule to get my URL's in proper shape. I'm no Apache
expert, so it was a cut and paste job, and I've read that there are
situations in which POST data can be inadvertently dumped during
rewrites.

Anyway, thanks for the assistance, but this deserves a new thread, so
I'll repost if I'm still getting nowhere.

Thanks,
Adam


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



Re: Form data not available in controller

2008-04-25 Thread seb

 Sorry, I just meant the error message I added in my controller (the
 flash message in the else clause) i.e. cakephp doesn't think there's
 anything in $this-data.

In your controller, did you try this :

$this-Model-create();
$this-Model-save($this-data);

instead of :

$this-Model-create($this-data);
$this-Model-save();

Since you say that data are POSTed, $this-data is filled. Seems that 
something is wrong in the save part of your code.

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



Re: Form data not available in controller

2008-04-25 Thread Amit Badkas
- Please debug the $this-params['form'] and $this-data in your
controller's action and take a look at it if something is not working
properly

On Thu, Apr 24, 2008 at 9:49 PM, zendrumz [EMAIL PROTECTED] wrote:


 Hey everyone,

 I'm a cakephp newbie putting together my first project. I'm trying to
 save form data to my database through a form generated by the
 formHelper in a view element. The problem I'm having is that $this-
 data is apparently empty when I try to access it from my controller.
 I've checked my HTTP headers, and my form data is indeed being POSTed.
 I've followed all of cakephp's naming conventions and the framework
 does have proper access to the database. When I submit the form, the
 controller branches to display the error message in my view, along
 with the following:

 1 query took 2 ms
 Nr  Query   Error   AffectedNum. rows   Took (ms)
 1   DESCRIBE `contacts` 6   6   2


 Here's the relevant code:

 Model:

 class Contact extends AppModel
 {
var $name = 'Contact';
 }

 Controller:

 class ContactsController extends AppController{
var $name = 'Contacts';
var $helpers = array('Html','Javascript','Form');
function add(){
if (!empty($this-data)){
if($this-Contact-create($this-data) 
 $this-Contact-save())
 {
$this-flash('Your information has been
 saved.','/');
}
}
else{
$this-flash('An error has ocurred. Please contact us
 directly at:
 info (at) shrineaudio (dot) com.','/');
}
}
 }

 Form:

 div id=contactsdiv
 h2contact us/h2
 ?php
echo $form-create('Contact');
echo $form-input('name', array('label' = 'span*Name:/span'));
echo $form-input('email', array('label' =
 'span*Email:/span'));
echo $form-input('phone', array('label' = 'spanPhone:/span'));
echo $form-input('message', array('type' = 'textinput','label' =
 'span class=leftalign*Tell us about your project:/
 span','div'='leftalign'));
echo $form-submit('submitbutton.gif');
echo $form-end();
 ?
 /div

 Any help would be greatly appreciated. As you can see, I essentially
 copied the code for my model and controller from the blog tutorial, so
 I'm at a loss as to explain why it isn't working. Thanks a lot!

 



-- 
Regards,
Amit

http://amitrb.wordpress.com/
http://coppermine-gallery.net/
http://cheesecake-photoblog.org/
http://www.sanisoft.com/blog/author/amitbadkas

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



Re: Form data not available in controller

2008-04-24 Thread seb

 When I submit the form, the
 controller branches to display the error message in my view, along
 with the following:
 
 1 query took 2 ms
 NrQuery   Error   AffectedNum. rows   Took (ms)
 1 DESCRIBE `contacts` 6   6   2

Well, *which* error message ? It could be helpful :)

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



Re: Form data not available in controller

2008-04-24 Thread zendrumz



On Apr 24, 12:36 pm, seb [EMAIL PROTECTED] wrote:
  When I submit the form, the

  controller branches to display the error message in my view, along
  with the following:

  1 query took 2 ms
  Nr Query   Error   AffectedNum. rows   Took (ms)
  1  DESCRIBE `contacts` 6   6   2

 Well, *which* error message ? It could be helpful :)

Sorry, I just meant the error message I added in my controller (the
flash message in the else clause) i.e. cakephp doesn't think there's
anything in $this-data.

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



Re: Form Data Validation problem...

2008-01-30 Thread Dardo Sordi Bogado

This:
   class UserAppModel extends AppModel{

should be:

   class UserModel extends AppModel{

On Jan 30, 2008 8:04 PM, Pq2son2 [EMAIL PROTECTED] wrote:

 Hi,

 First Thanks, I'm a newbaby andI read a lot of manuals and the API but
 I don't found the reason because the CakePHP (version 1.2.0.6311)
 doesn't validate any parameter. Here I write the simple exemple that I
 try for test the validation in this framework.

 Model:
 ?php
 class UserAppModel extends AppModel{
 var $name=User;

 var $validate= array(
 'password' = array(
 'rule' = 'alphanumeric',
 'required' = true,
 'allowEmpty' = false,
 'message'= 'Error!'
 )
 );
 }
 ?


 Controller:
 ?php

 class UsersController extends AppController{
 var $name = Users;
 var $helpers= array('Html','Form');

 function index(){
 if(!empty($this-data)){
 $this-User-set($this-data);
 if($this-User-validates()){
 echo No hay ningun error;
 }else{
 echo ERROR!!;
 }
 }
 }
 }
 ?

 View:
 ?php echo $form-create('User',array('action'='index'));?
 ?php echo $form-input('password');?
 ?php echo $form-error('User.password','Aixo no vaaa!! arg!!');?
 ?php echo $form-submit('Ok');?
 ?php echo $form-end();?


 It's really simply but doesn't work! and I don't know why, if any one
 can found the problem and say it to me, really thanks.

 The bakery's that I read are:
 - Validation with CakePHP 1.2: 
 http://cakebaker.42dh.com/2007/01/03/validation-with-cakephp-12/-
 - Multiple Rules of Validation per... :
 http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-field-in-cakephp-1-2
 - CakePHP Manual: http://manual.cakephp.org/chapter/validation
 - And others. really I don't understand how make it works.

 Thanks

 


--~--~-~--~~~---~--~~
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 data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-27 Thread Claudia

Hi Jon

Just quick status report: I have just tried with FF 2 on winXP. If I
disable the browser cache it is working fine, if the browser cache is
enabled only the first post goes through, all the others not.
Unfortunately I don't know why though - my forms have a similar setup
and work just fine (without having to set any cache headers or so).
Maybe you could post the relevant part of your controller?

Claudia

Jon Hinson wrote:
 I'm not sure what the nocache trick is. I tried sticking META Http-
 Equiv=Pragma Content=no-cache in my head, adding the hidden
 field with a random value, and adding a random number as a parameter
 to the end of my URL. I'm still getting the same outcome. What's
 weird, even if $_POST isn't being populated, I can refresh Firefox,
 and the popup box that says The page you are trying to view contains
 POSTDATA comes up. So it has been posted to, but I think $this-data
 is not being populated by cake for some reason. If we can somehow find
 out why $this-data is not being populated, we can get to the bottom
 of this.

 Jon

 On Sep 26, 5:56 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Okay, I tried using Galeon a few more times.
 
  1) Enter abc / def
  2) Submit
  3) Page draws with post
  4) Sumbit again.
  5) Page draws with no post (clears fields)
  6) Enter abc / def
  7) Submit
  8) Page draws with post
  9) add d to the end of abc
  10) Submit again
  11) Page draws with post
 
  So maybe it is a cache thing.  maybe try the nocache trick
 
  And if all else fails try sticking this:
 
  ? unset($User['User']['random']); ?
  ?= $html-hidden('User/random', random()) ?
 
  in your form.  As that should change every time.
 
  Jeff


--~--~-~--~~~---~--~~
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 data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-27 Thread Grant Cox

FF2 and WinXP here, and it is working fine - repeated submits (new or
same data) always comes through.


--~--~-~--~~~---~--~~
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 data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-26 Thread [EMAIL PROTECTED]

From what I can tell Jon, $_POST populated as expected.

It was only empty when I loaded the page the first time.

Jeff


--~--~-~--~~~---~--~~
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 data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-26 Thread Jon Hinson

How many times did you try submitting the form? This is very odd. What
browser are you using? I tried to reproduce the problem on my iPhone
using Safari, and it took many more submittions, but out of about 20
submittions, $_POST was not populated 3 times. I know that doesn't
sound like much, but when it's almost EVERY time after the second
submission with IE 6 and Firefox, it's very frustrating and I want to
know what I'm doing wrong.

On Sep 26, 4:30 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 From what I can tell Jon, $_POST populated as expected.

 It was only empty when I loaded the page the first time.

 Jeff


--~--~-~--~~~---~--~~
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 data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-26 Thread [EMAIL PROTECTED]


I typed garbage in the form like 8 times.  I just went back and did it
like 8 more times and barring some errors the first time (session
expired stuff) it still works like a charm...

I used firefox 1.5 on mandrivia 10.2 linux.  works without a hitch..

However, I just tried it on Galeon and got your 2nd submission POST
death.

Wierd.

Jeff

On Sep 26, 3:59 pm, Jon Hinson [EMAIL PROTECTED] wrote:
 How many times did you try submitting the form? This is very odd. What
 browser are you using? I tried to reproduce the problem on my iPhone
 using Safari, and it took many more submittions, but out of about 20
 submittions, $_POST was not populated 3 times. I know that doesn't
 sound like much, but when it's almost EVERY time after the second
 submission with IE 6 and Firefox, it's very frustrating and I want to
 know what I'm doing wrong.

 On Sep 26, 4:30 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

  From what I can tell Jon, $_POST populated as expected.

  It was only empty when I loaded the page the first time.

  Jeff


--~--~-~--~~~---~--~~
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 data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-26 Thread Jon Hinson

Jeff,

Thanks for taking your time to help with this. So it's definitely
browser based. Could it be a caching issue maybe?

Jon

On Sep 26, 5:24 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I typed garbage in the form like 8 times.  I just went back and did it
 like 8 more times and barring some errors the first time (session
 expired stuff) it still works like a charm...

 I used firefox 1.5 on mandrivia 10.2 linux.  works without a hitch..

 However, I just tried it on Galeon and got your 2nd submission POST
 death.

 Wierd.

 Jeff

 On Sep 26, 3:59 pm, Jon Hinson [EMAIL PROTECTED] wrote:

  How many times did you try submitting the form? This is very odd. What
  browser are you using? I tried to reproduce the problem on my iPhone
  using Safari, and it took many more submittions, but out of about 20
  submittions, $_POST was not populated 3 times. I know that doesn't
  sound like much, but when it's almost EVERY time after the second
  submission with IE 6 and Firefox, it's very frustrating and I want to
  know what I'm doing wrong.

  On Sep 26, 4:30 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

   From what I can tell Jon, $_POST populated as expected.

   It was only empty when I loaded the page the first time.

   Jeff


--~--~-~--~~~---~--~~
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 data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-26 Thread [EMAIL PROTECTED]

Okay, I tried using Galeon a few more times.

1) Enter abc / def
2) Submit
3) Page draws with post
4) Sumbit again.
5) Page draws with no post (clears fields)
6) Enter abc / def
7) Submit
8) Page draws with post
9) add d to the end of abc
10) Submit again
11) Page draws with post

So maybe it is a cache thing.  maybe try the nocache trick

And if all else fails try sticking this:

? unset($User['User']['random']); ?
?= $html-hidden('User/random', random()) ?

in your form.  As that should change every time.

Jeff



--~--~-~--~~~---~--~~
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 data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-26 Thread Jon Hinson

I'm not sure what the nocache trick is. I tried sticking META Http-
Equiv=Pragma Content=no-cache in my head, adding the hidden
field with a random value, and adding a random number as a parameter
to the end of my URL. I'm still getting the same outcome. What's
weird, even if $_POST isn't being populated, I can refresh Firefox,
and the popup box that says The page you are trying to view contains
POSTDATA comes up. So it has been posted to, but I think $this-data
is not being populated by cake for some reason. If we can somehow find
out why $this-data is not being populated, we can get to the bottom
of this.

Jon

On Sep 26, 5:56 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Okay, I tried using Galeon a few more times.

 1) Enter abc / def
 2) Submit
 3) Page draws with post
 4) Sumbit again.
 5) Page draws with no post (clears fields)
 6) Enter abc / def
 7) Submit
 8) Page draws with post
 9) add d to the end of abc
 10) Submit again
 11) Page draws with post

 So maybe it is a cache thing.  maybe try the nocache trick

 And if all else fails try sticking this:

 ? unset($User['User']['random']); ?
 ?= $html-hidden('User/random', random()) ?

 in your form.  As that should change every time.

 Jeff


--~--~-~--~~~---~--~~
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 data and Models

2006-07-27 Thread gopher

Well, validating file input fields doesn't work by default, so I was
going to this manually.

However I'm still not able to access the data variable in the model:

if(empty($this-data))
{
  $this-render();
}

else
{
  if(!$this-Menu-validates($this-data))
  {
$this-Menu-set('data', $this-data);

$this-render();
  }

  else
  {
// Upload file and move it to Webroot/files/menu

Stuff;
  }
}

When I do a debug($this-data); in beforeValidate() all I get is an
empty array. Any ideas?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Form data and Models

2006-07-27 Thread ryanb006

Are you using HtmlHelper's functions to create all your form elements?
Check the resulting HTML in your browser and ensure that your form's
method is POST and that your input field names all are like
data[Model][field].

HTH,
Ryan


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Form data and Models

2006-07-25 Thread nate

Most form data that comes from elements created with HtmlHelper or
FormHelper are available in the Controller in $this-data.  Everything
else is in $this-params['form'].

As far as validation, if you're calling $Model-save($this-data), then
$this-data should be available in the model.  Otherwise, call
$Model-set($this-data), and then validate().  However, unless you
have some specific need to do so, you shouldn't need to call validate()
before saving, since save() validates automatically, and will return
false if validation fails.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---