cancel
Showing results for 
Search instead for 
Did you mean: 

InputField Validation

Former Member
0 Kudos

Hi,

How to perform this validation.

I am having a input field. when user does not enter any value, i have to check this and raise a message. How do i do this in web dynpro's.

I tried by using the length() method but i am getting "Null Pointer Exception".

Example:

String abc = object.getABC();

if( abc.length() != 0 )

{

// here i will pop up the error window.

}else{}

Any help is highly appreciated.

Thanks

Rg/Venkat

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos
if (abc == null || abc.length() == 0)
{
  /* abc is not set or empty string */
}

Armin

Former Member
0 Kudos

Hi Venkatesan,

Instead of abc.length() != 0, try "abc.length < 1".

best regards

Shyam.

arun_srinivasan
Contributor
0 Kudos

hi

In the web dynpro explorer expand the dictionary and select local dictionary and then data type and right click the simple type and create simple type. give simple type name and package.

open the simple type and give bulid in type, maximum length and minimum length.

go the value attribute of input field and in the property tab set this type(simple type)

u try this too

in the action of any button

String x=wdContext.currentContextElement().getVA_<value attribute name>();

if(x.length() == 0)

{

wdComponentAPI.getMessageManager().reportWarning("Please enter the Name");

}

hope this helps,

regards,

Arun

Message was edited by: Arun