cancel
Showing results for 
Search instead for 
Did you mean: 

Validation on Simple Type variables

Former Member
0 Kudos

Hi,

I have created one simple type variable of String in dictionary and has set its fixed length property to 4.

Next created a context variable of type above one and binded to text field so that it accepts only 4 characters.

Now I have a clear button which should erase all data in that text field when I click clear. So the problem is that I can clear when number of characters in text field is 4 only else giving me that length if text field did not expected length of 4 characters.

Is there any solution to implement this feature?

Thanks in advance for all your time and help.

Thanks and regards,

Shiva

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

do u want to work only with simple type? or else

If u want the length of the string to be 4 , then try this alternate.

Create a message of type error in the messagepool.

Let the context attribute be of type String.

In the onaction method of ur save button give the code:

{

//@@begin onActionsave(ServerEvent)

String str= wdContext.currentContextElement().get<att. name>();

int i=str.length();

if(i==4){

wdContext.currentContextElement().set<att name where u want to set>(str);

}

else{

IWDMessageManager msg= wdComponentAPI.getMessageManager();

msg.reportMessage(IMessage<comp name>.LENGTH,null,false);

}

//@@end

}

In the onactionclear()

{

wdContext.currentContextElement().setTest("");

}

Regards,

Rathna.

Former Member
0 Kudos

Hi Shiva,

The problem is that your action associated with the clear event is causing a validating round trip. To change this, double click on the action and check the "Without Validation" checkbox.

Good luck,

Atul