cancel
Showing results for 
Search instead for 
Did you mean: 

checking validation of user input

Former Member
0 Kudos

hii,

I have a value node 'Ctx_vn_Manager' and corresponding value attribute 'UserID' in both the UICust and view....This node fetches a list of values for managers in f4valuehelp.The code for fetching values in f4 is as follows:

public void populateManagers( )

{

//@@begin populateManagers()

wdThis.wdGetTdc_UICustController().fetchManager();

IPublicTdc_UICust.ICtx_vn_ManagerNode managerNode = wdThis

.wdGetTdc_UICustController()

.wdGetContext()

.nodeCtx_vn_Manager();

IPublicTdc_UICust.ICtx_vn_ManagerElement managerEle = null;

IPrivateTdc_AddProjectView.ICtx_vn_ManagerNode PMNode = wdContext.nodeCtx_vn_Manager();

IPrivateTdc_AddProjectView.ICtx_vn_ManagerElement PMEle = null;

for(int i=0; i<managerNode.size(); i++)

{

managerEle = managerNode.getCtx_vn_ManagerElementAt(i);

PMEle = PMNode.createCtx_vn_ManagerElement();

PMEle.setUserID(managerEle.getUserID());

PMEle.setUserName(managerEle.getUserName());

PMNode.addElement(PMEle);

}

wdThis.wdGetTdc_UICustController().attachManagerF4(wdContext.nodeCtx_vn_Manager().getNodeInfo()

.getAttribute(IPrivateTdc_AddProjectView

.ICtx_vn_ManagerElement

.USER_ID));

//@@end

}

This method is being called at wdInit() of View...There is a 'Add' button in View which adds details of a project before which it checks the validation of UserID field .The code for validation is written in addmethod of View .The code is as follows:

if(wdContext.nodeCtx_vn_Manager().currentCtx_vn_ManagerElement().getUserID()==null)

{

wdComponentAPI.getMessageManager().reportException("Please enter Project Manager",true);

return ;

}

But this code is not working...itz adding the details even if userID field is empty...even the 'return' statement is not working as well....!!!

Please do suggest.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

Could you try changing the condition to

if(wdContext.nodeCtx_vn_Manager().currentCtx_vn_ManagerElement().getUserID()==null || "".equals(wdContext.nodeCtx_vn_Manager().currentCtx_vn_ManagerElement().getUserID()))

{

wdComponentAPI.getMessageManager().reportException("Please enter Project Manager",true);

return ;

}

Regards,

Murtuza

Former Member
0 Kudos

hii ,

This is also not working out....It is not entering the 'if' block only.

Answers (1)

Answers (1)

nikhil_bose
Active Contributor
0 Kudos

try


if(wdContext.nodeCtx_vn_Manager().currentCtx_vn_ManagerElement().getUserID()==null)
{
wdComponentAPI.getMessageManager().reportException("Please enter Project Manager", false);
return ;
}

reportException("Please enter Project Manager", true) will not include next statement (return) call.

nikhil