cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to focus on a checkbox/radio button which failed validation?

Former Member
0 Kudos

Is there a way to set focus to check box or radio button which failed the validation check?

I heard that there is no suitable UI element for this purpose. I think the only way is put either invisable image or label UI element beside the group of radio button or check box. When there is an error, you can make the UI element becoming visiable?

Is this a bug or something just lacking in WDP?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Pran Bhas,

Yes, i am using

IWDMessageManager messgMan = wdComponentAPI.getMessageManager();

messgMan.reportContextAttributeMessage(wdContext.currentContextElement(),wdContext.getNodeInfo().getAttribute("key"),IMessageApp1.SOME,null,false);

But it only focus on the radio button when the user click on the error message. As i know if we use the same API apply to a input text UI element, it will draw a red color outline in the input text. Is there anyway to achieve similar effect for radio button ?

Thanks

Former Member
0 Kudos

Hi Yew

Yes you can,

I tried this with the standard Radiobutton element, I

created two of them and I mapped the 'selectedkey'

element property of both the radio buttons to a value

attribute undex the Context.

Inorder to report errors I used the reportContextAttributeMessage method of the IWDMessageManager class

Sample code


IWDMessageManager messgMan = wdComponentAPI.getMessageManager();
messgMan.reportContextAttributeMessage(wdContext.currentContextElement(),wdContext.getNodeInfo().getAttribute("key"),IMessageApp1.SOME,null,false);

Here "key" is the value attribute to which the

selectedKey property of the elements are bound.

IMessageApp1.SOME defines the error message which I have associated with radio button validation.

Once the error is diplayed on the screen , the message

can be clicked to obtain a focus on the element that has

invalid inputs. I used a dummy action attached to a

button to invoke the code

check this link for IWDMessageManager usage

http://help.sap.com/saphelp_nw04/helpdata/en/0d/5375848e41aa4c86219c80acd054df/frameset.htm

Regards

Pran