Re: How can I leave entered value even there is an errro and couldn't complete
On Aug 11, 11:06 am, leafchild wrote: > How can I get "$this->data" has "recursive = 6" data to avoid getting > "undefined index" error? I believe i had the same problem as you. Or in my case it was an overbelief in cakephp :P What you need to do is to ether re-read the original-data and then merge it with your post data, to get the "complete" recursive data- array. I've done that in a couple of places and it works, however there is a "better" solution I think. That would be that you fetch 2 arrays, one with the data that you will modify, and the other one containing the related data. The later one you will always fetch, while the first one is only for when you haven't submitted anything. --~--~-~--~~~---~--~~ 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: How can I leave entered value even there is an errro and couldn't complete
I don't even know if you *can* set recursive to 6. Use Containable and specify exactly which associations you want. On Tue, Aug 11, 2009 at 1:44 PM, leafchild book wrote: > Hi anurag, > You are saying I have to get POST data manually instead of using validation > ($this->Customer->validates())? > If I set id, then all the new information is replace back with old > information when coming back page with errors. > > Hi brian, > I didn't use Containable, only I do is when I get data I set recursive=6 so > I get all related information, > but this recursive stop working after coming back to page with errors. How > can I still make recursive active > so I don't get an "Undefined index" page. > > Thanks, > leafchild > > > On Tue, Aug 11, 2009 at 8:56 AM, brian wrote: >> >> I can't follow all of that but it seems like you'd be better off using >> Containable. >> >> On Tue, Aug 11, 2009 at 5:06 AM, leafchild >> wrote: >> > >> > Yes, I use $form->input() >> > >> > I found an issue because I was SQL again for the specific data before >> > going back to the page to show user an errors. >> > (I had an code like this that's why I couldn't keep the entered value >> > when there is an error. >> > === >> > function admin_edit(id = null){ >> > if (!empty($this->data)) { >> > ... >> > $this->data = $this->Customer->read(null, $id); >> > } >> > if (empty($this->data)) { >> > ... >> > $this->data = $this->Customer->read(null, $id); >> > } >> > >> > } >> > === >> > I took out the line "$this->data = $this->Customer->read(null, $id);" >> > in "if (!empty($this->data))" statement now I can keep the entered >> > value when there is an error. >> > However, now I have an other issue. >> > >> > In this admin/customers/edit page, I need to set "$this->Customer- >> >>recursive = 6;" to get all kind of information relates to Customer >> > from other table. >> > Either coming back with an error or success updating information(I >> > want to page to back to edit page not index page after "save"), >> > I get "Undefined index" error everywhere in this page because after >> > coming back to page, $this->data has only the information model show >> > relationship(I think,,, I have 4 "has one" relationship in this model >> > (Customer) and only those information is available from $this->data >> > after submit) >> > >> > How can I get "$this->data" has "recursive = 6" data to avoid getting >> > "undefined index" error? >> > >> > >> > thanks, >> > leafchild >> > >> > >> > >> > >> > >> > >> > On Aug 7, 6:22 pm, brian wrote: >> >> Are you using FormHelper to create your form elements? If you do, for >> >> example: >> >> >> >> echo $form->input('Post') >> >> >> >> ... the helper will add the value of the element based upon >> >> $this->data. >> >> >> >> If you are using the helper, maybe you should post your controller and >> >> view code. >> >> >> >> >> >> >> >> On Fri, Aug 7, 2009 at 6:56 PM,leafchild >> >> wrote: >> >> >> >> > I have a page with form. >> >> >> >> > If user entered name, address,,,and ,all kinds of information and >> >> > submit but there is mistakes such as not entered email >> >> > properly and came back to form page with error message. How can I >> >> > keep >> >> > the entered value user entered properly. >> >> >> >> > Currently in my form page, if user has an error, all the entered >> >> > value >> >> > are gone and user has to entered everything. >> > > >> > >> >> > > > > > --~--~-~--~~~---~--~~ 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: How can I leave entered value even there is an errro and couldn't complete
Hi anurag, You are saying I have to get POST data manually instead of using validation ($this->Customer->validates())? If I set id, then all the new information is replace back with old information when coming back page with errors. Hi brian, I didn't use Containable, only I do is when I get data I set recursive=6 so I get all related information, but this recursive stop working after coming back to page with errors. How can I still make recursive active so I don't get an "Undefined index" page. Thanks, leafchild On Tue, Aug 11, 2009 at 8:56 AM, brian wrote: > > I can't follow all of that but it seems like you'd be better off using > Containable. > > On Tue, Aug 11, 2009 at 5:06 AM, leafchild > wrote: > > > > Yes, I use $form->input() > > > > I found an issue because I was SQL again for the specific data before > > going back to the page to show user an errors. > > (I had an code like this that's why I couldn't keep the entered value > > when there is an error. > > === > > function admin_edit(id = null){ > > if (!empty($this->data)) { > >... > > $this->data = $this->Customer->read(null, $id); > > } > > if (empty($this->data)) { > > ... > > $this->data = $this->Customer->read(null, $id); > > } > > > > } > > === > > I took out the line "$this->data = $this->Customer->read(null, $id);" > > in "if (!empty($this->data))" statement now I can keep the entered > > value when there is an error. > > However, now I have an other issue. > > > > In this admin/customers/edit page, I need to set "$this->Customer- > >>recursive = 6;" to get all kind of information relates to Customer > > from other table. > > Either coming back with an error or success updating information(I > > want to page to back to edit page not index page after "save"), > > I get "Undefined index" error everywhere in this page because after > > coming back to page, $this->data has only the information model show > > relationship(I think,,, I have 4 "has one" relationship in this model > > (Customer) and only those information is available from $this->data > > after submit) > > > > How can I get "$this->data" has "recursive = 6" data to avoid getting > > "undefined index" error? > > > > > > thanks, > > leafchild > > > > > > > > > > > > > > On Aug 7, 6:22 pm, brian wrote: > >> Are you using FormHelper to create your form elements? If you do, for > example: > >> > >> echo $form->input('Post') > >> > >> ... the helper will add the value of the element based upon $this->data. > >> > >> If you are using the helper, maybe you should post your controller and > >> view code. > >> > >> > >> > >> On Fri, Aug 7, 2009 at 6:56 PM,leafchild > wrote: > >> > >> > I have a page with form. > >> > >> > If user entered name, address,,,and ,all kinds of information and > >> > submit but there is mistakes such as not entered email > >> > properly and came back to form page with error message. How can I keep > >> > the entered value user entered properly. > >> > >> > Currently in my form page, if user has an error, all the entered value > >> > are gone and user has to entered everything. > > > > > > > > > --~--~-~--~~~---~--~~ 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: How can I leave entered value even there is an errro and couldn't complete
I can't follow all of that but it seems like you'd be better off using Containable. On Tue, Aug 11, 2009 at 5:06 AM, leafchild wrote: > > Yes, I use $form->input() > > I found an issue because I was SQL again for the specific data before > going back to the page to show user an errors. > (I had an code like this that's why I couldn't keep the entered value > when there is an error. > === > function admin_edit(id = null){ > if (!empty($this->data)) { > ... > $this->data = $this->Customer->read(null, $id); > } > if (empty($this->data)) { > ... > $this->data = $this->Customer->read(null, $id); > } > > } > === > I took out the line "$this->data = $this->Customer->read(null, $id);" > in "if (!empty($this->data))" statement now I can keep the entered > value when there is an error. > However, now I have an other issue. > > In this admin/customers/edit page, I need to set "$this->Customer- >>recursive = 6;" to get all kind of information relates to Customer > from other table. > Either coming back with an error or success updating information(I > want to page to back to edit page not index page after "save"), > I get "Undefined index" error everywhere in this page because after > coming back to page, $this->data has only the information model show > relationship(I think,,, I have 4 "has one" relationship in this model > (Customer) and only those information is available from $this->data > after submit) > > How can I get "$this->data" has "recursive = 6" data to avoid getting > "undefined index" error? > > > thanks, > leafchild > > > > > > > On Aug 7, 6:22 pm, brian wrote: >> Are you using FormHelper to create your form elements? If you do, for >> example: >> >> echo $form->input('Post') >> >> ... the helper will add the value of the element based upon $this->data. >> >> If you are using the helper, maybe you should post your controller and >> view code. >> >> >> >> On Fri, Aug 7, 2009 at 6:56 PM,leafchild wrote: >> >> > I have a page with form. >> >> > If user entered name, address,,,and ,all kinds of information and >> > submit but there is mistakes such as not entered email >> > properly and came back to form page with error message. How can I keep >> > the entered value user entered properly. >> >> > Currently in my form page, if user has an error, all the entered value >> > are gone and user has to entered everything. > > > --~--~-~--~~~---~--~~ 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: How can I leave entered value even there is an errro and couldn't complete
Hi, Just set the Id so that it will get the reference on edit page. Regards, Anurag Pal On Tue, Aug 11, 2009 at 2:36 PM, leafchild wrote: > > Yes, I use $form->input() > > I found an issue because I was SQL again for the specific data before > going back to the page to show user an errors. > (I had an code like this that's why I couldn't keep the entered value > when there is an error. > === > function admin_edit(id = null){ > if (!empty($this->data)) { >... > $this->data = $this->Customer->read(null, $id); > } > if (empty($this->data)) { > ... > $this->data = $this->Customer->read(null, $id); > } > > } > === > I took out the line "$this->data = $this->Customer->read(null, $id);" > in "if (!empty($this->data))" statement now I can keep the entered > value when there is an error. > However, now I have an other issue. > > In this admin/customers/edit page, I need to set "$this->Customer- > >recursive = 6;" to get all kind of information relates to Customer > from other table. > Either coming back with an error or success updating information(I > want to page to back to edit page not index page after "save"), > I get "Undefined index" error everywhere in this page because after > coming back to page, $this->data has only the information model show > relationship(I think,,, I have 4 "has one" relationship in this model > (Customer) and only those information is available from $this->data > after submit) > > How can I get "$this->data" has "recursive = 6" data to avoid getting > "undefined index" error? > > > thanks, > leafchild > > > > > > > On Aug 7, 6:22 pm, brian wrote: > > Are you using FormHelper to create your form elements? If you do, for > example: > > > > echo $form->input('Post') > > > > ... the helper will add the value of the element based upon $this->data. > > > > If you are using the helper, maybe you should post your controller and > > view code. > > > > > > > > On Fri, Aug 7, 2009 at 6:56 PM,leafchild > wrote: > > > > > I have a page with form. > > > > > If user entered name, address,,,and ,all kinds of information and > > > submit but there is mistakes such as not entered email > > > properly and came back to form page with error message. How can I keep > > > the entered value user entered properly. > > > > > Currently in my form page, if user has an error, all the entered value > > > are gone and user has to entered everything. > > > --~--~-~--~~~---~--~~ 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: How can I leave entered value even there is an errro and couldn't complete
Hi, For that you have to pass values in input filed so that it will take it when it come back to page after getting validation errors. Regards, Anurag Pal On Aug 8, 3:56 am, leafchild wrote: > I have a page with form. > > If user entered name, address,,,and ,all kinds of information and > submit but there is mistakes such as not entered email > properly and came back to form page with error message. How can I keep > the entered value user entered properly. > > Currently in my form page, if user has an error, all the entered value > are gone and user has to entered everything. --~--~-~--~~~---~--~~ 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: How can I leave entered value even there is an errro and couldn't complete
Yes, I use $form->input() I found an issue because I was SQL again for the specific data before going back to the page to show user an errors. (I had an code like this that's why I couldn't keep the entered value when there is an error. === function admin_edit(id = null){ if (!empty($this->data)) { ... $this->data = $this->Customer->read(null, $id); } if (empty($this->data)) { ... $this->data = $this->Customer->read(null, $id); } } === I took out the line "$this->data = $this->Customer->read(null, $id);" in "if (!empty($this->data))" statement now I can keep the entered value when there is an error. However, now I have an other issue. In this admin/customers/edit page, I need to set "$this->Customer- >recursive = 6;" to get all kind of information relates to Customer from other table. Either coming back with an error or success updating information(I want to page to back to edit page not index page after "save"), I get "Undefined index" error everywhere in this page because after coming back to page, $this->data has only the information model show relationship(I think,,, I have 4 "has one" relationship in this model (Customer) and only those information is available from $this->data after submit) How can I get "$this->data" has "recursive = 6" data to avoid getting "undefined index" error? thanks, leafchild On Aug 7, 6:22 pm, brian wrote: > Are you using FormHelper to create your form elements? If you do, for example: > > echo $form->input('Post') > > ... the helper will add the value of the element based upon $this->data. > > If you are using the helper, maybe you should post your controller and > view code. > > > > On Fri, Aug 7, 2009 at 6:56 PM,leafchild wrote: > > > I have a page with form. > > > If user entered name, address,,,and ,all kinds of information and > > submit but there is mistakes such as not entered email > > properly and came back to form page with error message. How can I keep > > the entered value user entered properly. > > > Currently in my form page, if user has an error, all the entered value > > are gone and user has to entered everything. --~--~-~--~~~---~--~~ 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: How can I leave entered value even there is an errro and couldn't complete
Are you using FormHelper to create your form elements? If you do, for example: echo $form->input('Post') ... the helper will add the value of the element based upon $this->data. If you are using the helper, maybe you should post your controller and view code. On Fri, Aug 7, 2009 at 6:56 PM, leafchild wrote: > > I have a page with form. > > If user entered name, address,,,and ,all kinds of information and > submit but there is mistakes such as not entered email > properly and came back to form page with error message. How can I keep > the entered value user entered properly. > > Currently in my form page, if user has an error, all the entered value > are gone and user has to entered everything. > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How can I leave entered value even there is an errro and couldn't complete
I have a page with form. If user entered name, address,,,and ,all kinds of information and submit but there is mistakes such as not entered email properly and came back to form page with error message. How can I keep the entered value user entered properly. Currently in my form page, if user has an error, all the entered value are gone and user has to entered everything. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---