Skip to Content
author's profile photo Former Member
Former Member

How to check if FileUpload UI element containes some value?

Hi all WD gurus,

I have WD application on Java 6.40 portal. Application saves files from local HD into R/3 IXOS and this works fine. But I have another request:

FileUpload element is in one view (AddAttachment) with button for save file and confirmation button of whole document is in another view (InvoiceButtons).

If user chooses file from HD and don't save it in AddAttachment view, I have to check, if file was chosen. This control I have to do in InvoiceButtons view.

It is possible to check this or I'm not able to do this?

I kwow easier way is to map view context to the component controller context, but I got only "Object not found in cash - key is null" or similar error message...

Thanks for help

Ondrej

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jan 18, 2007 at 02:59 PM

    Hi Ondrej

    Webdynpro Events is another approach to establish communication between two views.

    - Declare new event X with parameter 'resource' in custom controller.

    - Declare method like fireEventX(resource) in the controller too.

    - View1 will call fireEventX(resource)

    - View2 will declare event handler onEventX(resource) and do necessary validation there.

    BR

    Sergei

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2007 at 01:28 PM

    If the properties "resource" and "data" of FileUpload control are bound to context attributes (binary or Resource), you may check the attribute to null:

    final IWDResource res = ...;
    if ( null == res )
    {
      ...
    }

    Let the attributes be in context of some Controller and both your views have context nodes mapped to it.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Let me guess your situation:

      You have Component or Custom Controller. In its context you created attribute named "SomeFileUploadResource".

      Add method ifFileUploadAble() which controls if the attribute is not null.

      You have view AddAttachment, create in its context here attribute "SomeFileUploadResource", map it to appropriate attribute in the controller.

      Bind the Resource property of FileUpload ui element to that attribute.

      Now the actual file data will be stored in the controller thru the view AddAttachment.

      In order to check if the data is available, from other view InvoiceButtons, you may call the method ifFileUploadAble() of the Controller.

      If this does not work, please describe in detail the errors you got.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.