You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Dale Newfield (JIRA)" <ji...@apache.org> on 2009/07/28 16:29:00 UTC

[jira] Created: (WW-3206) instructions for jsonValidationWorkflowStack don't suggest how to avoid uploading files during the validation step

instructions for jsonValidationWorkflowStack don't suggest how to avoid uploading files during the validation step
------------------------------------------------------------------------------------------------------------------

                 Key: WW-3206
                 URL: https://issues.apache.org/struts/browse/WW-3206
             Project: Struts 2
          Issue Type: Improvement
          Components: Other, XML Validators
            Reporter: Dale Newfield
            Assignee: Wes Wannemacher


http://struts.apache.org/2.x/docs/ajax-validation.html shows how to submit the form via ajax in such a way that it will not invoke the action, but only return the validation errors as json.  If the form includes a file to be uploaded, though, it will be uploaded both in this validation submission step and then in the actual form submission step.  Modification of the documentation/example code to show how to avoid that would be useful.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3206) instructions for jsonValidationWorkflowStack don't suggest how to avoid uploading files during the validation step

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46529#action_46529 ] 

Musachy Barroso commented on WW-3206:
-------------------------------------

Is there a way to avoid it?

> instructions for jsonValidationWorkflowStack don't suggest how to avoid uploading files during the validation step
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3206
>                 URL: https://issues.apache.org/struts/browse/WW-3206
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Other, XML Validators
>            Reporter: Dale Newfield
>            Assignee: Wes Wannemacher
>
> http://struts.apache.org/2.x/docs/ajax-validation.html shows how to submit the form via ajax in such a way that it will not invoke the action, but only return the validation errors as json.  If the form includes a file to be uploaded, though, it will be uploaded both in this validation submission step and then in the actual form submission step.  Modification of the documentation/example code to show how to avoid that would be useful.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3206) instructions for jsonValidationWorkflowStack don't suggest how to avoid uploading files during the validation step

Posted by "Bartłomiej Mocior (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47165#action_47165 ] 

Bartłomiej Mocior commented on WW-3206:
---------------------------------------

The problem is looks different than described above. The javascript serialization isn't working on <input type="file" ... /> fields. Files can't be serialized to JSON, on the server side you will get error from (FileUploadInterceptor I think) because you post FORM without enctype multipart/form-data with empty file field.

First workaround that pops into my mind is to manually exclude file field from JSON after serialization, and, if there is validation for file in the action class, remove it.
The second, very similar to the first one is to exclude field AND give the special parameter that will tell action to skip file validation, and in validation method check that parameter and if it's true, skip file validation.

I was wondering if there is possibility to make full use of JSON validation, even if we have FILE on form, maybe instead using form serialization, we can post the form to the IFRAME with additional parameter and get the validation result back from the IFRAME. This could be transparent (no code change would be required), but still... the file would be transferred 2 times.




> instructions for jsonValidationWorkflowStack don't suggest how to avoid uploading files during the validation step
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3206
>                 URL: https://issues.apache.org/struts/browse/WW-3206
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Other, XML Validators
>            Reporter: Dale Newfield
>            Assignee: Wes Wannemacher
>             Fix For: 2.1.9
>
>
> http://struts.apache.org/2.x/docs/ajax-validation.html shows how to submit the form via ajax in such a way that it will not invoke the action, but only return the validation errors as json.  If the form includes a file to be uploaded, though, it will be uploaded both in this validation submission step and then in the actual form submission step.  Modification of the documentation/example code to show how to avoid that would be useful.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-3206) instructions for jsonValidationWorkflowStack don't suggest how to avoid uploading files during the validation step

Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-3206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes Wannemacher updated WW-3206:
--------------------------------

    Fix Version/s: 2.1.9

I'll look at this for the 2.1.9 release

> instructions for jsonValidationWorkflowStack don't suggest how to avoid uploading files during the validation step
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3206
>                 URL: https://issues.apache.org/struts/browse/WW-3206
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Other, XML Validators
>            Reporter: Dale Newfield
>            Assignee: Wes Wannemacher
>             Fix For: 2.1.9
>
>
> http://struts.apache.org/2.x/docs/ajax-validation.html shows how to submit the form via ajax in such a way that it will not invoke the action, but only return the validation errors as json.  If the form includes a file to be uploaded, though, it will be uploaded both in this validation submission step and then in the actual form submission step.  Modification of the documentation/example code to show how to avoid that would be useful.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.