Hello,

I'm using CCK 6.x-3.x-dev with FileField 6.x-3.9.

I define a filefield type file in a custom content type.
The configuration is : required checked and number of value set to one.

The upload works great even when the user forget to click upload.
But if he forgets to select a file, it generates no warning. It happens on all browsers.

This error is huge that I think I'm doing wrong something.
Thanks for your advices

Comments

Vangoce’s picture

No idea?

quicksketch’s picture

Is this in conjunction with Content Profile module? That module has a long-standing incompatibility with FileFields on the registration form. Otherwise, I can't reproduce this issue so it's hard to suggest anything.

Vangoce’s picture

Thank you for the answer. We use this module. We'll try to remove it and check.

Vangoce’s picture

No link to Content Profile module. I solved the problem by updating the function filefield_widget_validate(&$element, &$form_state) in filefield_widget.inc. So now, we add an error if the filefield is empty and the attribut Required is true.

else {
form_error($element, t('The file referenced by the %field field does not exist.', array('%field' => $element['#title'])));
}
}
+ else {
+ if ($element['#required']) {
+ form_error($element, t('The file field %field is required', array('%field' => $element['#title'])));
+ }
+ }
}

quicksketch’s picture

Status: Active » Closed (fixed)

Closing this issue as it seems like @Vangoce found a solution... but it *shouldn't* be necessary. FileFields should properly validate like any other field. I personally can't reproduce a problem.