Hi all,
I have a form which is to accept image uploads and need some help with the
following:
1. My form allows a maximum of 3 images to be uploaded. I'm wondering if it
is necessary for me to check that not more than 3 are uploaded?
If yes, how do I do this? My input fields are called data[images][1],
data[images][2]... etc - I tried checking these fields using the array
length validator as below, but it always fails (even when the validation
conditions are met).
<validator class="arraylength">
<arguments base="data[Images][]">
<argument/>
</arguments>
<errors>
<error>Error</error>
</errors>
<ae:parameters>
<ae:parameter name="required">false</ae:parameter>
<ae:parameter name="min">0</ae:parameter>
<ae:parameter name="max">3</ae:parameter>
</ae:parameters>
</validator>
2. Is there any Agavi config variable that returns the full path to the pub/
dir? Right now I'm using
$target = AgaviConfig::get('core.app_dir') . '/../pub/';
but is there a better way?
3. I need to validate two fields together ie. sale price min and max and
return an error if min > max. I have absolutely no clue how to do this :)
except possibly to use an 'and' validator somehow...my initial attempts all
blew up in my face.
4. If the code in my Action throws and catches an Exception, how do I pass
the Exception message forward to the view? For example, in the below code,
I'd like to read $e->message and have that displayed in the Error view
public function executeWrite(AgaviRequestDataHolder $rd)
{
try {
// initialize object
$listing = new Listing();
// populate with validated input
$listing->fromArray($rd->getParameter('data'));
$listing->DisplayStatus = 0;
$listing->save();
return 'Success';
} catch (Exception $e) {
// $msg = $e->getMessage();
return 'Error';
}
}
Thanks,
Vikram
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users