cancel
Showing results for 
Search instead for 
Did you mean: 

how to comapre two input fields?

Former Member
0 Kudos

Hi

ihave input field with label from Year and another input field label with to Year,my condition should be in such away that value in from inputfield should not be greater than to input field vaule, can u tell me the code required for this

thanks

Durga

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,



int val1 = wdContext.currentContextElement().get<YourAttributeName>();
int val2 = wdContext.currentContextElement().get<YourAttributeName>();

if(val1 > val2)
 // TODO : code when val1 >val2
else
 // TODO: code for the else part

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

Suppose you have bound first input field value with context attribute ctx1 and second input field value with context attribute ctx2 and both ctx1 & ctx2 are integers, then

int year1 = wdContext.currentContextElement().getctx1();

int year2 = wdContext.currentContextElement().getctx2();

if(ctx1<=ctex2)

{

//Display error message here

}

Regards,

Apurva

Former Member
0 Kudos

Hi

date_end=wdContext.current<ABC>element.getDATE_END(); // get your end date
date_start=wdContext.current<ABC>element.getDATE_START(); // get your start date

if(date_end.before(date_start))
{
wdContext.currentContextElement().setResult("End Date Cannot beLess than Start Date"); // consider result to show the error message
}

Best Regards

Chaitanya.A