cancel
Showing results for 
Search instead for 
Did you mean: 

Validations in drop down

Former Member
0 Kudos

Hi,

I'm having some 5 to 6 drop down UI elements. In all the dropdowns it has a some 10 names listed.

I have to check the condition that, no name has been selected twice.

how to get the selected name of the dropdown and check it with the other dropdowns selected name.

help me out with detailed procedure.

thanks & regards,

Suresh

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi get the selected item by using the folloeing code

java.lang.String name=wdContext.currentContextElement().getVAName();

Then compare the above value with the other values selected in the dropdownlist

Hazrath.G

Former Member
0 Kudos

Hi ,

let you have 5 drop downs binded to value nodes test1,test2,test3,test4,test5 respectively.

The validate method would be

String [] testArr={wdContext.currentTest1Element().getTest(),
		wdContext.currentTest2Element().getTest(),
	wdContext.currentTest3Element().getTest(),
	wdContext.currentTest4Element().getTest(),
		wdContext.currentTest5Element().getTest()};
for(int i=testArr.length-1; i>1; i--)  
     for(int j=0; j<i; j++) 
 	  if( testArr<i>.equals(testArr[j]) ){
 	  	wdComponentAPI.getMessagemanager.reportWarning("Twice values selected  "+testArr<i>);
 	  	return;
   }

Regards,

Naga