Re: how to abort save?

2009-05-26 Thread Teh Treag

cakephp101,

You don't have to save the records that would put a blank row in your
table.

What validation rules are you using now?  You can set some of your
fields as 'notEmpty' or 'required'.  You stated you are using saveAll
(); are you aware of the validate option for saveAll()?
http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/

For more information on validation see the links I posted earlier.

-teh

On May 25, 8:32 pm, cakephp101 valenzuela...@gmail.com wrote:
 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 andy.baugh...@gmail.com wrote:

  Why not allow the blank record to save as NULL?

  On May 24, 9:01 pm, cakephp101 valenzuela...@gmail.com 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 vikhya...@gmail.com 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 valenzuela...@gmail.com wrote:

 how? i'm sorry i just learned cakephp few weeks ago.

 On May 22, 2:52 pm, Dr. Loboto drlob...@gmail.com wrote:

  You should use validation for it.

  On May 22, 12:15 pm, cakephp101 valenzuela...@gmail.com 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?

2009-05-25 Thread cakephp101

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 vikhya...@gmail.com 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 valenzuela...@gmail.com wrote:

  how? i'm sorry i just learned cakephp few weeks ago.

  On May 22, 2:52 pm, Dr. Loboto drlob...@gmail.com wrote:

   You should use validation for it.

   On May 22, 12:15 pm, cakephp101 valenzuela...@gmail.com 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?

2009-05-25 Thread andy

Why not allow the blank record to save as NULL?

On May 24, 9:01 pm, cakephp101 valenzuela...@gmail.com 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 vikhya...@gmail.com 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 valenzuela...@gmail.com wrote:

   how? i'm sorry i just learned cakephp few weeks ago.

   On May 22, 2:52 pm, Dr. Loboto drlob...@gmail.com wrote:

You should use validation for it.

On May 22, 12:15 pm, cakephp101 valenzuela...@gmail.com 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?

2009-05-25 Thread cakephp101

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 andy.baugh...@gmail.com wrote:
 Why not allow the blank record to save as NULL?

 On May 24, 9:01 pm, cakephp101 valenzuela...@gmail.com 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 vikhya...@gmail.com 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 valenzuela...@gmail.com wrote:

how? i'm sorry i just learned cakephp few weeks ago.

On May 22, 2:52 pm, Dr. Loboto drlob...@gmail.com wrote:

 You should use validation for it.

 On May 22, 12:15 pm, cakephp101 valenzuela...@gmail.com 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?

2009-05-22 Thread Dr. Loboto

You should use validation for it.

On May 22, 12:15 pm, cakephp101 valenzuela...@gmail.com 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?

2009-05-22 Thread Teh Treag

cakephp101,

I think you should start checking out the section of the book on
validation - http://book.cakephp.org/view/125/Data-Validation
Specifically, I think you want to read this section -
http://book.cakephp.org/view/740/notEmpty

-teh

On May 22, 12:15 am, cakephp101 valenzuela...@gmail.com 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?

2009-05-22 Thread cakephp101

how? i'm sorry i just learned cakephp few weeks ago.

On May 22, 2:52 pm, Dr. Loboto drlob...@gmail.com wrote:
 You should use validation for it.

 On May 22, 12:15 pm, cakephp101 valenzuela...@gmail.com 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?

2009-05-22 Thread forrestgump


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 valenzuela...@gmail.com wrote:
 how? i'm sorry i just learned cakephp few weeks ago.

 On May 22, 2:52 pm, Dr. Loboto drlob...@gmail.com wrote:

  You should use validation for it.

  On May 22, 12:15 pm, cakephp101 valenzuela...@gmail.com 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
-~--~~~~--~~--~--~---



how to abort save?

2009-05-21 Thread cakephp101

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



Re: how to abort save?

2009-05-21 Thread JamesF

can you clarify what you mean 'by rows of forms'

i assume you mean fields in a table...


On May 21, 10:29 pm, cakephp101 valenzuela...@gmail.com wrote:
 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
-~--~~~~--~~--~--~---



Re: how to abort save?

2009-05-21 Thread cakephp101


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