cancel
Showing results for 
Search instead for 
Did you mean: 

how to make an input filed mandatory ?

Former Member
0 Kudos

if Message Manager is used it shows an errror in 'attributeInfo'...

do we have to define 'attributeInfo' before using it here:

IWDMessageManager msgMgr =

this.wdThis.wdGetAPI().getComponent().getMessageManager();

msgMgr.reportContextAttributeMessage(

this.wdContext.currentContextElement(), <u>attributeInfo</u>,

IMessageSimpleErrors..MISSING_INPUT, new Object[] {"Name"},true);

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hai ,

Create a label set the labelfor property to input field, Set the input field property state is required.

Write the code when click the submit button

String valueOfInputField=wdContext.currentContextElement.getX();

if(valueOfInputField==null || valueOfInputField.trim().equals(")){

msgMgr.reportWarning(" Name is Mandatory");

}

regards,

Naga Raju

Former Member
0 Kudos

HI

public void checkMandatory(String name,String filedContextID)

{

String attributeValue = wdContext.currentContextElement.getAttributeAsText(filedContextID);

String attributeinfo = wdCotext.getNodeInfo().getAttribute(filedContextID);

if(attributeValue ==" ")

{

ur reportContextAttrMsg()

}

}

Declare u context attribute name in current View method

Where you used this method.

This.checkMandatory("Ur errorMsg",Attributeof declaredView);

Or Do u need to * red color ur input filed label do follow.

set the property state as required for the input Field

In the Label's property labelFor set the coressponding text field's Id.

Thanks

Lohi.

Message was edited by: Lohitha M

saraswathi_d
Participant
0 Kudos

Hi,

Set the State Property of the input field is required

Regards,

Saraswathi

Former Member
0 Kudos

Yes we need to define attribute info before using it.

If you have defined the attribute in your root context, you need to obtain it in the following way :


IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute("ContextAttributeName");

Regards,

Subramanian V.