Integration for: https://github.com/kartik-v/bootstrap-fileinput

See https://github.com/l0rdn1kk0n/wicket-bootstrap/issues/372
Well, indeed the ajaxBehavior field is not needed anymore, I had a previous
version in mind. Let me work over this to make it better.


2014-06-11 11:54 GMT+02:00 subes <gsubes@gmail.com>:

> The behavior is needed to implement a workaround for the fileinput
> javascript added upload button to work via ajax. You can only define a ajax
> URL, but that one cannot handle multiupload. Thus I work around this by
> catching the upload button click and invoking the ajax behaviors callback
> via the self defined event for that particular fileuploadfield. If there is
> no javascript enabled in the browser, the upload button will fallback to
> using a normal post form submit that uploads the file. The ajaxBehavior is
> needed as a field variable so that the callback url can be rendered
> properly in the renderHead(...).
> Also the newAjaxFormSubmitBehavior method is defined in order for a user
> to be able to customize the ajax callback that is executed. e.g. to add
> ajax attributes or override the submit method.
>
>
> 2014-06-11 11:48 GMT+02:00 Martin Grigorov <notifications@github.com>:
>
> In
>> bootstrap-extensions/src/main/java/de/agilecoders/wicket/extensions/markup/html/bootstrap/fileinput/BootstrapFileUploadField.java:
>>
>> > +
>> > +@NotThreadSafe
>> > +public class BootstrapFileUploadField extends FileUploadField {
>> > +
>> > +    private static final String UPLOAD_BUTTON_CLASS = "fileinput-upload-button";
>> > +    private static final String AJAX_EVENT_NAME = "fileinput-upload-button-clicked";
>> > +
>> > +    private final AjaxFormSubmitBehavior ajaxBehavior;
>> > +    private boolean showCaption = false;
>> > +    private boolean showPreview = true;
>> > +    private boolean showRemove = false;
>> > +    private boolean showUpload = true;
>> > +
>> > +    public BootstrapFileUploadField(final String id, final IModel<List<FileUpload>> model) {
>> > +        super(id, model);
>> > +        ajaxBehavior = newAjaxFormSubmitBehavior(AJAX_EVENT_NAME);
>>
>> Why ajaxBehavior is a member field ?
>> It seems it is not used out of the constructor.
>>
>> And why this behavior has to be added to the FileUploadField at all ?
>> Usually the application decides whether it wants to submit the form with
>> Ajax or not.
>> Please remove it from here.
>>
>> —
>> Reply to this email directly or view it on GitHub
>> <https://github.com/l0rdn1kk0n/wicket-bootstrap/pull/383/files#r13641241>
>> .
>>
>
>