on 09-25-2008 6:08 PM
Hi Team,
I am working on with file upload UI.
Some times without clicking on browse button, I mean without entering any file they are cliking on upload button, which is giving the exception.
I know there is no action for UI element, Then how to resolve this?
I just control the user, not to press the upload button without entering any file name there?
How to resolve this?
regards,
Bala
Hi,
This code will solve ur problem.
public void onActionUploadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionUploadFile(ServerEvent)
IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateFileUploadDownloadView.IContextElement.FILE_RESOURCE);
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)attributeInfo.getModifiableSimpleType();
IPrivateFileUploadDownloadView.IContextElement element = wdContext.currentContextElement();
if(element.getFileResource() !=null)
{
try
{
String mimeType = binaryType.getMimeType().toString();
byte[] file = element.getFileResource();
//element.s
wdComponentAPI.getMessageManager().reportMessage(IMessageFileUploadDownloadComp.SF__UPLOAD,new Object[] {binaryType.getFileName()},false);
}
catch(Exception e)
{
throw new WDRuntimeException(e);
}
}
else
{
wdComponentAPI.getMessageManager().reportMessage(IMessageFileUploadDownloadComp.NO__FILE,new Object[] {" "},true);
}
//@@end
}
Here "fileresource" is context attribute name
Regards,
Sunaina Reddy T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In my case it is working fine. try to copy the same code.if it is null then the control will go to else part.
Do u have any idea on Message pool ?
In my code SF__UPLOAD and NO__FILE are Message keys.
create these 2 message keys and copy the same code.
Regards,
Sunaina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if (element.getFileResource() != null) {
try {
String mimeType = binaryType.getMimeType().toString();
byte[] file = element.getFileResource();
...
...
wdContext.currentcontextelement.setuploadbuttonenable("true");
}
} catch (Exception e) {
throw new WDRuntimeException(e);
}
}
else
{
wdContext.currentcontextelement.setuploadbuttonenable("false");
}
I think this can help you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai bala,
I am having a suggestion. You can try set the upload button as disabled initially. you can enable it only after the user clicks the browse button. I am new to this web dyn pro. so this is my idea. if it was wrong inform me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.