Re: how to abort save?
because i have a list of the timesheet in a table and it looks odd to have a blank row in the table. On May 25, 7:45 pm, andy wrote: > Why not allow the blank record to save as NULL? > > On May 24, 9:01 pm, cakephp101 wrote: > > > thanks for the reply but the thing is it's ok for the field to be > > empty but it should not be saved in the database. i'm using foreach > > loop for my saveAll for each of the fields so i want to know how to > > abort the save for the empty ones. > > > On May 22, 11:12 pm, forrestgump wrote: > > > > Just follow the links provided by Teh Treag . Basically u need to > > > define the validation function in your Model to make sure the field it > > > not empty . > > > > forrestgump > > > > On May 22, 12:06 pm, cakephp101 wrote: > > > > > how? i'm sorry i just learned cakephp few weeks ago. > > > > > On May 22, 2:52 pm, "Dr. Loboto" wrote: > > > > > > You should use validation for it. > > > > > > On May 22, 12:15 pm, cakephp101 wrote: > > > > > > > yes, i mean fields in a table. i'm doing a timesheet for a payroll. > > > > > > the start sched, end sched, time in and time out of the employee are > > > > > > the input. that means i have 4 fields. i have 5 rows of those 4 > > > > > > fields. the 5 rows is equal to 5 days because 1 row is equal to 1 > > > > > > day. > > > > > > when i only put input in 4 of the rows and 1 form is empty, it will > > > > > > still save the empty fields with a null value in my database. i'm > > > > > > saving it through saveAll. how can i abort the save for the fields > > > > > > that are empty? i think it should be done in beforeSave but i don't > > > > > > know how. --~--~-~--~~~---~--~~ 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 to abort save?
thanks for the reply but the thing is it's ok for the field to be empty but it should not be saved in the database. i'm using foreach loop for my saveAll for each of the fields so i want to know how to abort the save for the empty ones. On May 22, 11:12 pm, forrestgump wrote: > Just follow the links provided by Teh Treag . Basically u need to > define the validation function in your Model to make sure the field it > not empty . > > forrestgump > > On May 22, 12:06 pm, cakephp101 wrote: > > > how? i'm sorry i just learned cakephp few weeks ago. > > > On May 22, 2:52 pm, "Dr. Loboto" wrote: > > > > You should use validation for it. > > > > On May 22, 12:15 pm, cakephp101 wrote: > > > > > yes, i mean fields in a table. i'm doing a timesheet for a payroll. > > > > the start sched, end sched, time in and time out of the employee are > > > > the input. that means i have 4 fields. i have 5 rows of those 4 > > > > fields. the 5 rows is equal to 5 days because 1 row is equal to 1 day. > > > > when i only put input in 4 of the rows and 1 form is empty, it will > > > > still save the empty fields with a null value in my database. i'm > > > > saving it through saveAll. how can i abort the save for the fields > > > > that are empty? i think it should be done in beforeSave but i don't > > > > know how. --~--~-~--~~~---~--~~ 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 to abort save?
how? i'm sorry i just learned cakephp few weeks ago. On May 22, 2:52 pm, "Dr. Loboto" wrote: > You should use validation for it. > > On May 22, 12:15 pm, cakephp101 wrote: > > > yes, i mean fields in a table. i'm doing a timesheet for a payroll. > > the start sched, end sched, time in and time out of the employee are > > the input. that means i have 4 fields. i have 5 rows of those 4 > > fields. the 5 rows is equal to 5 days because 1 row is equal to 1 day. > > when i only put input in 4 of the rows and 1 form is empty, it will > > still save the empty fields with a null value in my database. i'm > > saving it through saveAll. how can i abort the save for the fields > > that are empty? i think it should be done in beforeSave but i don't > > know how. --~--~-~--~~~---~--~~ 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 to abort save?
yes, i mean fields in a table. i'm doing a timesheet for a payroll. the start sched, end sched, time in and time out of the employee are the input. that means i have 4 fields. i have 5 rows of those 4 fields. the 5 rows is equal to 5 days because 1 row is equal to 1 day. when i only put input in 4 of the rows and 1 form is empty, it will still save the empty fields with a null value in my database. i'm saving it through saveAll. how can i abort the save for the fields that are empty? i think it should be done in beforeSave but i don't know how. --~--~-~--~~~---~--~~ 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 to abort save?
i have 5 rows of forms for date and time. when only 4 out of the 5 forms are not null, how can i abort the save for the empty/null form? ps, the 5 forms are submitted at the same time so i only have to abort the save for the form/s with no entered value. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---