Skip to Content
0
Former Member
Jul 11, 2007 at 05:09 PM

Mandatory for Date field

23 Views

Hi All,

I want to display to Mandatory field if date field is blank or null...

But this code only valiadate ,the Entered date correct or not...

So how to display the Mandatory date field..

Please suggest me ...What is the error..

IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();

Object attributeValue = wdContext.currentDateFieldsElement().getAttributeValue(fieldName);

Date theDate =

(Date) wdContext.currentDateFieldsElement().getAttributeValue(

fieldName);

IWDAttributeInfo attributeInfo =

wdContext.nodeDateFields().getNodeInfo().getAttribute(fieldName);

Calendar c = Calendar.getInstance();

c.set(Calendar.HOUR_OF_DAY, 0);

c.set(Calendar.MINUTE, 0);

c.set(Calendar.SECOND, 0);

c.set(Calendar.MILLISECOND, 0);

Date currentDate = new Date(c.getTimeInMillis());

if (theDate.before(currentDate)) {

{

// Throw an error message

msgMgr.reportContextAttributeMessage(

wdContext.currentDateFieldsElement(),

attributeInfo,

IMessageRequisitionForm.MISSING_INPUT,

new Object[] { fieldLabel },

true);

}

}

}

Please Tel me ......

Thanks & regards

Mathi