cancel
Showing results for 
Search instead for 
Did you mean: 

How to validate input befor storing in Context Attribute

Former Member
0 Kudos

Hi

I create view and assigned UI elements to context attributes.i want to validate the entered input before values are getting stored in context node.Currently as part of the project,there is an input field where user supposed to enter the integer as input.but if he enter'%" charecter and clicks on save button,i am getting error called "Page Cannot be displayed error".so i wanted to check the input values before storing in the context.is there any better solution?please help

Prasad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello

If you have followed the above link, then its well and good.

I ll try to simpify it. Follow these steps

1. In the message pool of your DC/project declare a Message Key 'Missing_Input' having Message Type 'error', Message Text 'Please enter the '.

2. In the action handler of your 'Save' button write the following code

String name = wdContext.<get the value>;

if(null == name || "".equals(name ) || "0000000000".equals(name ) || name .length() <= 0)

{

IWDAttributeInfo nameInfo = wdContext.node<name>().getNodeInfo().getAttribute("<attribute name>");

msgMgr.reportContextAttributeMessage(wdContext.current<node name>Element(),nameInfo ,IMessage<ComponentName>Component.MISSING__INPUT,new Object[] { "<Name of attribute>" }, true);

}

Try this. I hope it helps you.

Regards

Kapil

Former Member
0 Kudos

Hi Kapil

Thanks for helping me out.i had given points

Prasad

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos