I've been looking at this for a few hours now and searched a lot of
posts, so I'm throwing my hands in the air and asking for help :)

I have an add method on my controller :

 function add()
           {

                if (empty($this->data) )
                {

                    $this->render('add');
                }
                else
                {


                    $this->data['Asset']['archive_state_id'] = 1;
                    $this->data['Asset']['asset_uri'] =
"tbd/fakefolder";
                    $this->data['Asset']['active'] = 'y';

                    if ($this->Asset->save($this->data))
                    {
                        $assetId = $this->Asset->getLastInsertId();

                        $this->data['AssetData']['asset_id'] =
$assetId;


                        if ($this->Asset->AssetData->save($this->data))
                        {
                            $this->flash("saved the asset",
"/assets/add");
                        }
                        else
                        {

                            $this->set('data', $this->params['data']);
                            $this->validateErrors($this->AssetData);
                            $this->render('add');
                        }
                    }
                }
            }


my add view has the appropriate html tag tagErrorMsg

<form method="post" action="<?php echo $html->url('/assets/add')?>">
    <p>
        Slug :
        <?php echo $html->input('AssetData/slug', array('size' =>
'50'))?>
        <?php echo $html->tagErrorMsg('AssetData/slug', 'Slug is
required.') ?>
    </p>
    <p>
        Other Info:
        <?php echo $html->textarea('AssetData/other_info',
array('rows'=>'10')) ?>
    </p>
    <p>
        <?php echo $html->submit('Save') ?>
    </p>
</form>

my asset data model has the validate array :

var $validate = array(

        'slug'  => VALID_NOT_EMPTY


    );

and my AssetController has the correct uses :

           var $uses = array('Asset', 'AssetData');


What happens right now is it correctly saves the asset and then save on
the AssetData model returns false since the validation fails (I see it
by single stepping the code) but my html tag error messages never get
displayed...

Please someone help me from this frustration :)

Thanks
Grant


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to