FORMfields, the premiere web framework
Login
Support Home | Knowledge Base | Documentation | Forums | Contact Us
Info
FORMfields & FORMgen :: Field Customizations

Removing the URL (Upload Preview) from an UploadField

(1137 views. Last Updated: 2007-08-08 4:56 PM)

If there is an error in your form when a user uploads a file, the uploaded file will become visible (as a preview). We believe this preview to be very useful to the user, however you can remove it by:

1. Replace something like:
$ffForm->addField(new UploadField("upload", "Upload", FORM_FIELD_REQUIRED, 2000000));
with:
$ffForm->addField(new UploadField("upload", "Upload", FORM_FIELD_REQUIRED, 2000000));
$ffForm->formFields["upload"]->enableUploadNow = false;

2. Add code to clear the values of the uploaded field upon form errors in ConfirmButtonListener::onClick() and SubmitButtonListener::onClick():
Replace:
if ($ffForm->checkValues()) {
...
}
with:
if ($ffForm->checkValues()) {
...
} else {
$ffForm->formFields["upload"]->clearValue();
}
Info
Support | Earn Money
Copyright © 2005-2019 Brain Book Software LLC.
Built with FORMfields, the premiere web framework.