cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if FileUpload UI element containes some value?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

siarhei_pisarenka3
Active Contributor
0 Kudos

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

Former Member
0 Kudos

To Siarhei Pisarenka:

thank you, it was preciselly what I needed.

Problem is solved

Answers (1)

Answers (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Dzmitri,

thank you for reply.

As I wrote, when I mapped Resource attribute to the some Controller, application don't work and I get error message.

I use for testing purposes NW 2004 Sneak and there all works fine, but on this 6.40 server I have problems. I tried to perform hints fro forums (create Node element for Resource and Description of the file), but it all failed :(.

I have to know, if Resource attibute in AddAttachment view is accesible from InvoiceButtons view without context mapping?

Thank you, Ondrej

Former Member
0 Kudos

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.