The QFileAsset Control
The
QFileAsset control is a great example of a complex control that combines many simpler controls to provide
a single, cohesive control that is very simple/straightfoward in terms of end-user usability.
Combining
QPanels,
QButtons,
QDialogBox,
QImageControl and of course
QFileControl, the QFileAsset is an alternative to the standard
<input type="file"> approach to handling file uploads on forms.
Moreover, while
<input type="file"> and
QFileControl requires a form to be submitted via a
QServerAction (as opposed to a
QAjaxAction),
because the actual file upload mechanism is in a separate dialog box, this does allow you to have an entire form submitted via AJAX, while at the same time
the file upload, itself, is specifically performed using its own QServerControlAction within the
QFileAsset dialog box.
And finally, as this example shows,
QFileAsset allows you to process through the standard
QForm validation
process (e.g. checking and reporting on failed "Required" constraints) in a way that makes sense,
and in a way that does not necessarily force the user to re-upload on every form submit.