Sorted it.  It was because the relationship is a hasMany, so the data
should have been passed as...

Array
(
    [Booking] => Array
        (
            [event_id] => 17
            [booking_type] => is_physical_tickets
            [post_to_wall] => 1
        )

    [PhysicalTicket] => Array
        0 => Array
            (
                [name] => Toby Griffiths
                [phone_no] =>
                [no_of_tickets] => 10
            )
        )

    [submit] => Request tickets
    [add_more_text] => SOMETHING RANDOM
)

On Dec 1, 5:05 pm, Toby G <t...@cubicmushroom.co.uk> wrote:
> Hi there,
>
> Version: 1.3.12
>
> I seem to be having a problem with the 'numeric' validation rule on an
> associated Model's fields.  For some reason it is not validating '10'
> as a valid numeric value.
>
> Here are the validation rules for the (PhysicalTicket) no_of_tickets
> field in question...
>
>                 'no_of_tickets' => array(
>                         'numeric' => array(
>                                 'rule' => array('numeric'),
>                                 'message' => 'Please provide the number of 
> tickets you require',
>                                 'allowEmpty' => false,
>                                 //'required' => false,
>                                 //'last' => false, // Stop validation after 
> this rule
>                                 //'on' => 'create', // Limit validation to 
> 'create' or 'update'
> operations
>                         ),
>                         'between' => array(
>                                 'rule' => array('between', 1, 9),
>                                 'message' => 'Please provide the number of 
> tickets you require
> (between 1 & 9 can be booked at a time)',
>                                 'allowEmpty' => false,
>                                 //'required' => false,
>                                 //'last' => false, // Stop validation after 
> this rule
>                                 //'on' => 'create', // Limit validation to 
> 'create' or 'update'
> operations
>                         ),
>                 ),
>
> And here is the data being validated (using saveAll)...
>
> Array
> (
>     [Booking] => Array
>         (
>             [event_id] => 17
>             [booking_type] => is_physical_tickets
>             [post_to_wall] => 1
>         )
>
>     [PhysicalTicket] => Array
>         (
>             [name] => Toby Griffiths
>             [phone_no] =>
>             [no_of_tickets] => 10
>         )
>
>     [submit] => Request tickets
>     [add_more_text] => SOMETHING RANDOM
> )
>
> The validation error show is "Please provide the number of tickets you
> require" rather than the expected "'Please provide the number of
> tickets you require (between 1 & 9 can be booked at a time)"
>
> Any help with this one would be great.
>
> Thanks,
>
> T

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

Reply via email to