cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a field to required?

Former Member
0 Kudos

Hi all -

This is my first Web Dynpro, so I'm sorry if the question is silly. I am trying to set an input field on my view to required, and so within the properties I have changed the state from normal* to required. This will put a red asterisk next to the label for the Input Field, to show it is required! However, if left blank, nothing happens - it processes as normal.

Do I have to build the error handling in myself for when the required field isn't populated? This simply struck me as something that I would think would be provided within standard Web Dynpro functionality, but it appears it isn't, or I'm doing something incorrectly.

If any could offer any advice, I'd greatly appreciate it. Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Armin

Answers (3)

Answers (3)

Former Member
0 Kudos

Abigail,

As far as it your first post on SDN forums, please read this https://www.sdn.sap.com/irj/sdn/crphelp

VS

arun_srinivasan
Contributor
0 Kudos

hi abigail

Go the web dynpro explorer there u have dictionary.u create a simple data types.

In the simpletype u select definition tab.

*select build in type as string

*Then set the maximum and minimum length(give minimum length as 1)

map this simple type to the value attribute of the input field .

It will automatically throws message when u not given value to input field

hope this help u better

Regards,

Arun

Former Member
0 Kudos

Hi

In the message pool give the required message u wanted to be displayed and give the message type as error.

In the view controller create a method with return type Boolean

In the implementation of ur view controller give the following code

public boolean <method name>( )

{

IWDMessageManager mesMgr =

wdThis.wdGetAPI().getComponent().getMessageManager();

if (wdContext.current<nodename>Element().get<attribute name>() instanceof String) {

return true;

}

else {

mesMgr.reportContextAttributeMessage(

this.wdContext.current<nodename>Element(),

this.wdContext.node<nodename>().getNodeInfo().getAttribute("<att. name>"),

IMessage<component name>.DESIRED_NAME,

null,

true);

return false;

}

}

Hope this helps u.

Regards,

Rathna.