cancel
Showing results for 
Search instead for 
Did you mean: 

Required InputField

Former Member
0 Kudos

Hi all,

I've created a context in my Custom Controller like as follow:

Person -> Value Node

IdPerson -> Attribute (java.lang.Long)

Name -> Atrribute (string)

In my view, i've defined the State of InputField to required, when i run the Application, the field appears with *, but when i call a action, the required isn't verified.

The action isn't with the "Without validation" option selected.

Does anybody knows what can i do to enable the required validation automatically?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Isaias,

Setting the property to required only gives the red * next to the field but doesnot validate automatically.

You need to write the code for validation yourself.

Hope that helps,

Thanks,

Rajit

Answers (3)

Answers (3)

Former Member
0 Kudos

Dynpro framework validates numeric fields as mandatory anyways, so the inputfield can't be empty or contain non-numeric chars , you can still validate for a valid ID tho :).

If you are referring to your <Name> inputfield, well you can validate the same way i explained here:

[Dynamic validation regardless UI element|;

Regards.

Julio Herrera

Former Member
0 Kudos

Hi all,

Thanks by responses

Isaías Barroso

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Isaias,

Check this PDF: [Validations|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/837d9290-0201-0010-1381-e633fe17cb14]

Regards, Suresh KB

Former Member
0 Kudos

Hi Isaias,

You can proceed in this way

e.g. if language is the required field, then

try

{

if(wdContext.nodeLanguage_Key_Node().currentLanguage_Key_NodeElement().getCtx_language_key_node().trim().equals(""))

{ wdComponentAPI.getMessageManager().reportException("Enter Language", true);

}

}

catch(Exception e1)

{

wdComponentAPI.getMessageManager().reportException("Enter Language", true); }

and then you call this function whenever you want.

if you want to put asterik mark dynamically , you can create a context variable ( lets say ctx_State) of the type state and then assign it to the state proprty of the input field.

and then write the code as:

wdContext.currentContextElement().setCtx_State(WDState.REQUIRED);

Hope this helps,

Thanks & Regards,

Namrta Mahajan