Hello,
My associated model validation for Uploads(MeioUpload) while saving
multiple model associations at once does not work.
I'm using the MeioUpload plugin for uploading files. Each Upload is related
to a News with a one to many relationship. When I try to save an Upload at
the same time as saving a new News the validation for the Upload model
doesn't work. My other associated model validations work fine, but not the
Upload model.
I think this might be because the validation for the Upload model is
handled by the MeioUpload plugin?
Here's my view:
<?php echo $this->Form->create('News'); ?>
> <fieldset>
> <legend><?php echo 'Add News'; ?></legend>
> <?php
> echo $this->Form->input('News.member_id');
> echo $this->Form->input('News.newstype_id');
> echo $this->Form->input('News.company_id');
> echo $this->Form->input('News.title');
> echo $this->Form->input('News.body');
> echo $this->Form->input('News.alert');
>
> echo $this->Form->input('Company.name');
>
> echo $this->Form->input('Upload.filename', array('type'=>'file'));
> echo $this->Form->input('Upload.dir', array('type'=>'hidden'));
> echo $this->Form->input('Upload.mimetype', array('type'=>'hidden'));
> echo $this->Form->input('Upload.filesize', array('type'=>'hidden'));
> echo $this->Form->input('Upload.download', array('label'=>'Add to
> Downloads'));
> ?>
> </fieldset>
> <?php echo $this->Form->end(__('Submit')); ?>
Here's how I'm saving the data:
> $this->News->create();
$this->News->saveAll($this->request->data)
I've also tried $this->News->saveAssociated and tried saving through the
association like: $this->News->Upload->saveAll($this->request->data). That
doesn't work either.
The News Model fields all validate and the associated Company Model field
validates but it does not validate the Upload Model fields. It acts as if
there's no validation. And when I choose a file to upload and hit the
Submit button it doesn't remember the file that I chose to upload. It
completely ignores the Upload fields in the form.
Note: the Upload works perfectly fine on its own while not saving
associated models. I can upload files and it validates just fine, its only
when trying to save with associated models.
Any help in identifying what I'm doing wrong is appreciated. Thanks.
Andrew
--
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.