cancel
Showing results for 
Search instead for 
Did you mean: 

input field

Former Member
0 Kudos

Hi,

I have one requirement that is i have 2 input fields called fristname and lastname actually to display a error message we need to use message editor but the message will be shown at end of the view but my requirement is i need to display message beside of input field can any body tell how to do this with clear steps.

Regards,

Kemp

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

You can use the below mentioned code to get the required result

wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.currentContextElement(),wdContext.getNodeInfo().getAttribute("Va_FirstName"),IMessageTestComp.SEARCH,new Object[]{"Va_FirstName"},false);

this will be helpfull in ur case.

Regards

Narendra Singh

Former Member
0 Kudos

Hi Kemp,

I got ur point.. u need to use Message editor wid message pool

this doc fits in ur requirement go through this :[doc|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f4d79e59-0601-0010-0689-89670315bc6b]

for a refrence u cn chk this too:[Ref|http://www.vogella.de/articles/SAPWebDynpro/article.html]

hope it hlps u

Regards

Khushboo

Former Member
0 Kudos

Try this


IWDNodeElement element = wdContext.nodeTest().getCurrentElement();
    IWDAttributeInfo attribute = wdContext.nodeTest().getNodeInfo().getAttribute( "name_value");
    
    wdComponentAPI.getMessageManager()
    	.reportInvalidContextAttributeException( element, attribute, "Error", false);

For details use this java doc.

https://media.sdn.sap.com/html/submitted_docs/60_sp2_javadocs/webdynpro/com/sap/tc/webdynpro/progmod...

Hope this is what you asked for.

Regards

Vinod

nikhil_bose
Active Contributor
0 Kudos

Plz see the MessageArea UI element.

For your requirement, as I understood, try IWDMessageManager. raiseInvalidContextAttributeException(IWDNodeElement element, IWDAttributeInfo attribute, String message, boolean cancelNavigation)

see [IWDMessageManager API|http://help.sap.com/javadocs/NW04/current/wd/com/sap/tc/webdynpro/progmodel/api/IWDMessageManager.html]

nikhil

Former Member
0 Kudos

Hi,

Can u give the clear steps

Regards,

girish

Former Member
0 Kudos

Hi nikhil,

Can u give the clear steps

Regards,

girish

nikhil_bose
Active Contributor
0 Kudos

you can refer the code by Vinod

As I understood the problem, An error message, if any, would be point to the InputField where the user enters at runtime.

sol:

Context:

Input (node, 1..1)

-Name(attr, String)


I<Comp_Name>.IInputElement element = wdContext.currentInputElement();
IWDAttributeInfo atrinfo = wdContext.nodeInput().getNodeInfo().getAttribute( "Name");
if( wdContext.currentInputElement().getName()== null) {
wdComponentAPI
.getMessageManager
.reportInvalidContextException( element, atrinfo, "This field can't be empty", false);
} else{
....

}

if this is not what you looking for, plz feel free to put question clearly.

nikhil

Former Member
0 Kudos

HI nikh,

I have one requirement that is i have 2 input fields called fristname and lastname actually to display a error message we need to use message editor but the message will be shown at end of the view. But my requirement is i need to display message beside of input field can any body tell how to do this with clear steps. Where i need to write code in inputfield action or some where

Regards,

Kemp

nikhil_bose
Active Contributor
0 Kudos

ok. you can put a message area UI element and place it where you want the message to display. Usually only one message area is used globally and for particular exception handling, plz refer last post.

nikhil

Former Member
0 Kudos

Hi Kemp,

Assuming that you are trying to validate user input, I would suggest the following -

Use Matrix Layout. Make the layoutdata property of both input fields as 'Matrix head data'. After each input field insert one 'Label' element with layoutdata property as 'Matrix Data'.

Bind the 'visible' property of the two labels to context attributes say visibility1 and visibility2 of type 'com.sap.ide.webdynpro.uielementdefinitions.Visibility' and 'text' property of the labels to context attributes say error1 and error2 of type string.

Whenever your input criteria for any inputfield is not met, you should set the Label's text property by changing the context attribute it is mapped to (error1 or error2), and also make it visible by changing the visibility context attribute.

The message area UI element is not useful for you here as you can not have two message area elements. The MessageArea UI element represents a placeholder that specifies where all the webdynpro error messages or warnings, should appear in the view.

Hope this helps.

Regards,

Anagha

Former Member
0 Kudos

Hi Jawalekar,

Thank you for your reply,I need to show error message at run time by using msgpool and also i need to show if entered text in input is wrong then i need to show error message and input field must be in red color.can you tell me how to do this with clear steps.

Regards,

Kemp

Edited by: kemp sath on Dec 24, 2008 8:08 AM

Former Member
0 Kudos

This might help you

https://wiki.sdn.sap.com/wiki/display/WDJava/ValidatingWebDynproJavaapplications

Regards,

Jawed Ali

Former Member
0 Kudos

you can give invisible label fields next to the inputfields make them visible and invisible dynamically and also populate the error message on that label.

Thanks and Regards

shanto aloor

Former Member
0 Kudos

Hi shantoo,

Thank you for ur quick response i do it same but it is not working can u give the brief steps

Regards,

Girish