cancel
Showing results for 
Search instead for 
Did you mean: 

Validation of Required Fields

Former Member
0 Kudos

Hi,

I am able to validate the required fields and display messages in bottom of application using following code.

private void checkMandatoryValues(String fieldName, String fieldValue, String fieldText,IWDMessageManager msgMgr)

{

if(fieldValue==null || fieldValue.length()==0){

IWDAttributeInfo attInfo = wdContext.nodeNotice().getNodeInfo().getAttribute(fieldName);

msgMgr.reportContextAttributeMessage( wdContext.currentNoticeElement(),

attInfo,

IMessageNoticeManagerComp.MANDATORY_ITEM,

new Object[]{fieldText},

true );

}

}

Now requirement, to make the UIElements( InputFileds, Dropdowns....) in red color or some thing different looking,visually indicate the fields that are missing.

Please help me in this context.Thanks in Advance.

Regards,

Davood.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Davood,

Set the 'state' property of your input fields to 'required' and link your labels to the input fields with 'labelFor'. Then the labels will show a little star and users will know these fields are required.

Validation you still will have to do on your own, though.

Regards

Markus

Former Member
0 Kudos

Hi Markus,

Is it possible to highlight UI elements(which not given information) after submiting the data without giving all the required fields?

Please help me.

Regards,

Davood.

Former Member
0 Kudos

Hi Davood,

This is what you do in msgMgr.reportContextAttributeMessage()

Calling that method will create messages (displayed in the message area) that link (just try click them) to the fields that are bound to the context attributes. The fields also will have some tooltip with the error message.

Don't know if it is possible to explicitely set colors or things on UI elements because everything is style-sheet based as far as I know (beginners' level).

Regards

Markus

Former Member
0 Kudos

Markus,

Thanks a lot, my problem was solved. I forget to mention the message type as "error" in message pool.

Regards,

Davood.

Answers (0)