By drupalhook on
Hi,
I have installed IMAGE module and tried to create image for image gallery. But without uploading an image the form submits. I already set the "required" attributes in image.moduel file, please see the below codes.
$form['image'] = array(
'#type' => 'file',
'#title' => t('Image'),
'#size' => 40,
'#required' => TRUE,
'#description' => t('Click "Browse..." to select an image to upload.'),
'#weight' => -3,
);
After this change, without uploading an image file it is showing an error and after uploading an image also it is showing the same error "image field is required".
please help me, how can I make image upload field mandatory?
Comments
You could add your own
You could add your own function with $form['#validate'][]='your_function_name' and check manually whether an image has been uploaded... just an idea
I am also wondering the same
I am also wondering the same thing as the original poster. Can anyone suggest a solution for this?
that was frustrating...
updating the modules fixed the issue, even though I didn't see it in the release notes
image upload
Add $form['#attributes']['enctype'] = 'multipart/form-data'; to ur form