cancel
Showing results for 
Search instead for 
Did you mean: 

FileName Validation

Former Member
0 Kudos

Hi All,

Is there a solution for this problem? I can't see any method of Resource or InputStream which can serve the purpose. The bad part is if someone manually enters junk characters in the file name input field (w/o using Browse button), the browser only shows the circular in-progress image. One has to log off from portal. I fear if this endless loop continues, it may even bring down the J2EE server.

This is a very basic validation, and I can't deliver the application w/o adding this validation

Please help! Thanks in advance ...

Best Regards,

-AW

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Adam,

I am facing the same problem in my appliaction and the application goes for a toss.

If u hav found any solution to the above problem plz fwd it to me on email addr sudeep196@yahoo.co.in

Thnx,

Sudeep Sura

SRudra
Contributor
0 Kudos

Hi,

Write a method as public void checkMandatory(java.lang.String fieldName).. within it write a logic to check for all invalid characters by iteration ... the moment if find a invalid charater highlight the field asking the user to input once again into the field.

The method would have coding like ... plz use your own logic to build it further.

public void checkMandatory(java.lang.String fieldName) {

WDMessageManager messageMgr = this.wdThis.wdGetAPI().getComponent().getMessageManager();

Object attributeValue = this.wdContext.currentContextElement().getAttributeValue(fieldName);

IWDAttributeInfo attributeInfo = this.wdContext.getNodeInfo().getAttribute(fieldName);

if (attributeValue instanceof String) {

if (((String) attributeValue).length() == 0) {

for (;;;) // logic to check the invalid characters

{

String fieldLabel = this.wdContext.getNodeInfo().getAttribute(fieldName).getSimpleType().getFieldLabel();

messageMgr.reportContextAttributeMessage(this.wdContext.currentContextElement(),

attributeInfo,

IMessageSimpleErrors.INVALID_INPUT,

new Object[] { fieldLabel },

true);

}

}

}

}