cancel
Showing results for 
Search instead for 
Did you mean: 

how to compare two input fields

Former Member
0 Kudos

Hi i have two input filds with labels E mail and confirmmail

in both the input flds same value should be enter ,if data in second input field is different from first input field an error should be displayed,can u please expalin me with code

thanks

kishore

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi ,

String emailId1 = wdContext.currentContextElement().getID1();

String emailId2 = wdContext.currentContextElement().getID2();

if(emailId1.equals(emailId2 )){

// same

}else{

// Different

}

Thanks,

Ramesh

Former Member
0 Kudos

Hi,

use as follows


String emailId1 = wdContext.currentContextElement().getID1();
	  String emailId2 = wdContext.currentContextElement().getID2();
//remove the following condition if not needed , 
	  if( (emailId1 != null && !emailId1.trim().equals("")) && ( emailId2 != null && !emailId2.trim().equals("")))
	  {
		  int x = emailId1.compareTo(emailId2);
		  if( x == 0)
			  //Both are same
		  else
			  //Do the else part
	  }

Regards

Ayyapparaj