3 Replies Latest reply on Apr 1, 2008 6:28 AM by Ilya Shaikovsky

    fileUpload and ajaxSingle

    Jim Dummy Newbie

      hello!

      I can not upload a text file and return it into the form.

      <rich:fileUpload fileUploadListener="#{MyForm.upload}">
       <a4j:support event="onuploadcomplete" ajaxSingle="true" reRender="myTextArea"/>
      </rich:fileUpload>
      
      


      I catch the file into upload(UploadEvent event) method and put it into the String, but then this string is overwritten by the textarea itself (calling setMyTextArea())

      I tried to use "region" - no luck! :-(

      Any idea?

      Thank you

        • 1. Re: fileUpload and ajaxSingle
          mars1412 Apprentice

          I'm not sure this helps, but it sounds like the problem that is described in the rich-faces sample: 'local-value-demo'

          • 2. Re: fileUpload and ajaxSingle
            Jim Dummy Newbie

            Exactly! haven't seen it.
            The only problem is that "region" doesn't work:

            <a4j:region>
             <rich:fileUpload
             immediate="true"
             fileUploadListener="#{AnySequenceForm.upload}"
             uploadData="#{AnySequenceForm.files}"
             maxFilesQuantity="1"
             immediateUpload="true"
             autoclear="true"
             listHeight="30px"
             fileEntryControlClass="UploaderEntryControlClass"
             uploadListClass="UploaderListClass">
             <a4j:support
             event="onuploadcomplete"
             ajaxSingle="true"
             reRender="the_sequence_panel"/>
             </rich:fileUpload>
            </a4j:region>
            


            As far as I understand "region" limits the information to be send to the server by ajax request so my "BAD" textarea shouldn't be updated... but it is.

            Should I submit a bug?



            • 3. Re: fileUpload and ajaxSingle
              Ilya Shaikovsky Master

              fileUpload submits all the form. To avoid this problem you could:

              1) Split forms for upload and output
              2) Split value bindings for uploaded file and text area.
              a)Bind textarea to some bean property and upload file to the other one.
              b) in ajaxSingle request from your support - set the textArea property value to the value of the second propety