cancel
Showing results for 
Search instead for 
Did you mean: 

Doubt in validation

Former Member
0 Kudos

Hello gurus!

I have a doubt about a validation in a textfield. I have done a little code to validate the textfield only receive letters. The code works fine but the problem is with the warning message I want to display. Below the screen a warning message is displayed when somebody writes something different ti letters, but I want this to appear in a textbox right below the textfield too. In a tutorial I've found an example doing this but this, receiving 3 arguments. In my code if I try to put only 3 arguments an error message tells me that the code is expecting 5 arguments. Here is my code:

*messageMgr.reportContextAttributeMessage(wdContext.nodeBuscaIniciativasForm().currentBuscaIniciativasFormElement(),*

** wdContext.nodeBuscaIniciativasForm().getNodeInfo().getAttribute(element.NO_CLIENTE),**

** IMessageIniciativasComp.SICRESE__NO_CLIENTE,**

** new Object[] ,**

** true);**

And there is the tutorial example:

messageMgr.reportContextAttributeMessage(wdContext

.currentContextElement().getAttributePointer(fieldName),

IMessageSimpleErrorsComp.MISSING_INPUT,

new Object[] );

Is there anything I have missed??

Regards IA

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Armando

The method that you are using is deprecated. try to use this:

messageMgr.reportContextAttributeMessage(wdContext.nodeBuscaIniciativasForm().getNodeInfo().getAttribute(element.NO_CLIENTE), 
 IMessageIniciativasComp.SICRESE__NO_CLIENTE,
 new Object[] { fieldLabel });

messageMgr.cancelNavigation();

The quantity of objects that you need to have in the 3° parameter, must be exactly the same quantity of parameters that you have in SICRESE__NO_CLIENTE message in message pool.

Regards

Marcos

Former Member
0 Kudos

Hello Marcos

Thanks for the answer. i've applied the code you kindly sent me but this error appears:

The method reportContextAttributeMessage(IWDNodeElement, IWDAttributeInfo, IWDMessage, Object[], boolean) in the type IWDMessageManager is not applicable for arguments (IWDAttributeInfo,IWDMessage, Object[])

The version I am using is the 7.0.11.

Regards

pravesh_verma
Active Contributor
0 Kudos

Hi Armando,

Can you try this code:


 messageMgr.reportContextAttributeMessage(wdContext.nodeBuscaIniciativasForm().getNodeInfo().getAttribute("NO_CLIENTE"), 
			  IMessageIniciativasComp.SICRESE__NO_CLIENTE,
			  new Object[] { "fieldLabel"});

I hope this will resolve the issue. In case you face any other issue then please let me know.

Thanks and Regards

Pravesh

Former Member
0 Kudos

Hi Armando

In version 7.0 doesn't have this method with this parameter, because this the error appears.

I've Tried with this 2 methods:

wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.nodeBuscaIniciativasForm().currentBuscaIniciativasFormElement().getAttributePointer(wdContext.nodeTest().currentTestElement().NO_CLIENT),
			  IMessageIniciativasComp.SICRESE__NO__MESSAGE,
			  new Object[] { "Parameter 1" });

And

wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.nodeTest().currentTestElement(),
	   wdContext.nodeTest().getNodeInfo().getAttribute(wdContext.nodeBuscaIniciativasForm().currentBuscaIniciativasFormElement().MESS),
	   IMessageIniciativasComp.SICRESE__NO_MESSAGE,
	   new Object[] { "Parameter 0" },
	   true);

In both you need to create one message in messgae pool with the name "sicrese_no_message" with one parameter in the message "".

Former Member
0 Kudos

Hello Marcos

Thanks for the examples, they have useful tips. In our first example everything is working just fine, but the message we want to show only displays in the bottom of the page, and we want to display it just below the text field. How can we do this?.

Regards

Former Member
0 Kudos

hi Armando

For a while i can't help in this case.

I never put one message per field. I always put only one message area, with all the messages.

I don't know if you saw , but when you click in message error, the focus is set to the field which cause the error. Then you know what is the problematic field.

Regards

Marcos

Former Member
0 Kudos

A Solution that you can do, is place a invisible component in the right side of the fields.

When that fields cause some error, you change the property visible to stay visible.

Regards

Marcos

Former Member
0 Kudos

Done, problem solved!!!

Thanks a lot for the help!

Regards