hiding the upload control while upload is in progress- bug

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

hiding the upload control while upload is in progress- bug

Adrian Baker
We wanted to hide the file upload control while an upload occurs, to prevent any further file selections & make it clear that the upload is in progress.

We had a solution that seemed to worked ok: make the target node of the upload control non-relevant. However we noticed that uploads from the last upload control on a form were being ignored: the file would be sent to the server, but the instance data would not get updated. Attached is an example which shows the problem (use firefox so xforms-select events get fired to trigger the upload) - try uploading files for each of the three upload controls, and the final one will get ignored.

The problem is this check in XFormsModelSubmission:

    boolean hasBoundRelevantUploadControl = false;
    if (serialize) {
        final List uploadControls = xformsControls.getCurrentControlsState().getUploadControls();
        if (uploadControls != null) {
            for (Iterator i = uploadControls.iterator(); i.hasNext();) {
                final XFormsUploadControl currentControl = (XFormsUploadControl) i.next();
                if (currentControl.isRelevant()) {
                    final NodeInfo boundNodeInfo = currentControl.getBoundNode();
                    if (currentInstance ==  model.getInstanceForNode(boundNodeInfo)) {
                        // Found one relevant bound control
                        hasBoundRelevantUploadControl = true;
                        break;
                    }
                }
            }
        }
    }

This check remains true in the first two uploads, but when the final upload is triggered & the last upload control becomes irrelevant, and this check is no longer  true. The resulting submission is then treated incorrectly (isDeferredSubmission becomes false and so forth).

So ideally this optimisation would be modified somehow to still detect the submission.. On the other hand I'm not sure exactly what the correct spec behaviour when the relevance of the upload node is changed to false on xforms-select: maybe *all* the uploads should be being ignored? Either way the current behaviour is inconsistent though, either they should all be ignored, or none.

Adrian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

newDocument.xhtml (294K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: hiding the upload control while upload is in progress- bug

Alessandro Vernet
Administrator
Adrian,

On 9/5/07, Adrian Baker <[hidden email]> wrote:
>
>  We wanted to hide the file upload control while an upload occurs, to
> prevent any further file selections & make it clear that the upload is in
> progress.

I was able to reproduce this as well. Thank you for the patch, we'll
try to review it as soon as we can. In the meantime, we have added a
bug to track this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=307526&group_id=168&atid=350207

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: hiding the upload control while upload is in progress- bug

Erik Bruchez
Administrator
In reply to this post by Adrian Baker
Adrian,

I was looking at this and I am a little confused. I do reproduce the
issue, I think.

However, newDocument.xhtml is very large that it seems I am spending too
much time trying to figure out what binds apply just to the issue of the
upload. Is there any way you could produce a smaller reproducible
example? This would help a bit.

Now the idea of the Java code you paste below is that we are trying to
figure out whether we must tell the client to actually perform a
background HTML form submission containing the files to upload.

If there are no bound upload controls, then it seems clear we do not
need to ask the client to perform that submission. If the upload
controls are not relevant, it seemed clear as well that those should not
be taken into account.

So it seems that there may be an issue with this, but I am not sure
exactly which issue since I can't quite figure out what your code tries
to do ;-)

-Erik

Adrian Baker wrote:

> We wanted to hide the file upload control while an upload occurs, to
> prevent any further file selections & make it clear that the upload is
> in progress.
>
> We had a solution that seemed to worked ok: make the target node of the
> upload control non-relevant. However we noticed that uploads from the
> last upload control on a form were being ignored: the file would be sent
> to the server, but the instance data would not get updated. Attached is
> an example which shows the problem (use firefox so xforms-select events
> get fired to trigger the upload) - try uploading files for each of the
> three upload controls, and the final one will get ignored.
>
> The problem is this check in XFormsModelSubmission:
>
>     boolean hasBoundRelevantUploadControl = false;
>     if (serialize) {
>         final List uploadControls =
> xformsControls.getCurrentControlsState().getUploadControls();
>         if (uploadControls != null) {
>             for (Iterator i = uploadControls.iterator(); i.hasNext();) {
>                 final XFormsUploadControl currentControl =
> (XFormsUploadControl) i.next();
>                 if (currentControl.isRelevant()) {
>                     final NodeInfo boundNodeInfo =
> currentControl.getBoundNode();
>                     if (currentInstance ==  
> model.getInstanceForNode(boundNodeInfo)) {
>                         // Found one relevant bound control
>                         hasBoundRelevantUploadControl = true;
>                         break;
>                     }
>                 }
>             }
>         }
>     }
>
> This check remains true in the first two uploads, but when the final
> upload is triggered & the last upload control becomes irrelevant, and
> this check is no longer  true. The resulting submission is then treated
> incorrectly (isDeferredSubmission becomes false and so forth).
>
> So ideally this optimisation would be modified somehow to still detect
> the submission.. On the other hand I'm not sure exactly what the correct
> spec behaviour when the relevance of the upload node is changed to false
> on xforms-select: maybe *all* the uploads should be being ignored?
> Either way the current behaviour is inconsistent though, either they
> should all be ignored, or none.
>
> Adrian
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: hiding the upload control while upload is in progress- bug

Adrian Baker
Hi Erik - here's a slightly simpler example. Our XForms+XHTML is generated though so it's a bit of an effort to get completely minimal.

I think in essence the issue is that if you make an upload control non-relevant as a result of the xforms-select event, the upload is ignored. ie

1.    user selects control to upload
2.    xforms-select event is fired
3.    handler for xforms-select event makes upload non-relevant
        handler for xforms-select event sends submission
4. submission is processed, but upload does not occur if no more uploads are relevant (it *does* occur if another upload on the form is still relevant, even if it's not the one selected by the user, which is now irrelevant).

Adrian

Erik Bruchez wrote:
Adrian,

I was looking at this and I am a little confused. I do reproduce the issue, I think.

However, newDocument.xhtml is very large that it seems I am spending too much time trying to figure out what binds apply just to the issue of the upload. Is there any way you could produce a smaller reproducible example? This would help a bit.

Now the idea of the Java code you paste below is that we are trying to figure out whether we must tell the client to actually perform a background HTML form submission containing the files to upload.

If there are no bound upload controls, then it seems clear we do not need to ask the client to perform that submission. If the upload controls are not relevant, it seemed clear as well that those should not be taken into account.

So it seems that there may be an issue with this, but I am not sure exactly which issue since I can't quite figure out what your code tries to do ;-)

-Erik

Adrian Baker wrote:
We wanted to hide the file upload control while an upload occurs, to prevent any further file selections & make it clear that the upload is in progress.

We had a solution that seemed to worked ok: make the target node of the upload control non-relevant. However we noticed that uploads from the last upload control on a form were being ignored: the file would be sent to the server, but the instance data would not get updated. Attached is an example which shows the problem (use firefox so xforms-select events get fired to trigger the upload) - try uploading files for each of the three upload controls, and the final one will get ignored.

The problem is this check in XFormsModelSubmission:

    boolean hasBoundRelevantUploadControl = false;
    if (serialize) {
        final List uploadControls = xformsControls.getCurrentControlsState().getUploadControls();
        if (uploadControls != null) {
            for (Iterator i = uploadControls.iterator(); i.hasNext();) {
                final XFormsUploadControl currentControl = (XFormsUploadControl) i.next();
                if (currentControl.isRelevant()) {
                    final NodeInfo boundNodeInfo = currentControl.getBoundNode();
                    if (currentInstance ==  model.getInstanceForNode(boundNodeInfo)) {
                        // Found one relevant bound control
                        hasBoundRelevantUploadControl = true;
                        break;
                    }
                }
            }
        }
    }

This check remains true in the first two uploads, but when the final upload is triggered & the last upload control becomes irrelevant, and this check is no longer  true. The resulting submission is then treated incorrectly (isDeferredSubmission becomes false and so forth).

So ideally this optimisation would be modified somehow to still detect the submission.. On the other hand I'm not sure exactly what the correct spec behaviour when the relevance of the upload node is changed to false on xforms-select: maybe *all* the uploads should be being ignored? Either way the current behaviour is inconsistent though, either they should all be ignored, or none.

Adrian





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

badUploadForm.xhtml (53K) Download Attachment