cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding validation of Inputfield

Former Member
0 Kudos

Dear Experts

I want to allow the user to enter only the digits.(Actually this inputfield is for "Year")

Please give me the sugeestions.

Urgent

Thanks

Hazrath.G

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can't force that in the browser, you can only check it on the server.

Armn

Former Member
0 Kudos

Thanks for ur immediate reply.

Then how to validate onserver side?

If he enters the year like:2007abcd (or )abcd

Then how can i validate that?

Generally noone enters the year like above.

But this is the client requirement.

Thanks

Hazrath.G

Former Member
0 Kudos

You could create a DDIC type and set the allowed format. Then the framework will automatically check the input against this format.

Armin

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Hazrath,

Check ASCII values for the keyboard key except numerics.

Regards,

Harish

Former Member
0 Kudos

Hi ,

Create an simple type called year and define validation there.

Now create a valueattribute and change the type to new simple type and bind ur input filed to this value attribute.

Thanks,

Sunitha

former_member197348
Active Contributor
0 Kudos

Hi Hazrath,

If you bind the attribute type of integer, the framework will do the rest (i.e. automatic validation). In validation you need to check the value is valid or not like

if(wdContext.currentContextElement().get<name>()>1999)

regards,

Siva

Former Member
0 Kudos

Thanks for immediate reply.

I have given 6 points to u.

My problem was not solved.

But I got some info from u.

Thing is ihave defined the datatype of year is string why

bcz in R/3 year data type is char of length 4.Give me the suggestions

Thanks

Hazrath.G

former_member197348
Active Contributor
0 Kudos

Hi Hazrath,

Say your attribute name is year of type integer.

You can convert it as String set it to your model attribute like this:

 wdContext.current<modelnode>().set<attribute>(String.valueOf(wdContext.currentContextElement().getYear()));

More Info:

If you want set Min. and Max. values for this input, create a simple type attribute as other forum members specified (Say YEAR).

Properties:

Built-In Type - integer

Value Constraints:

Minimum Inclusive -- MINIMUM YEARS ALLOWED ( e.g.1988)

Maximum Inclusive -- MAXIMUM YEARS ALLOWED ( e.g.1988)

Now set the attribute type to this YEAR. Now all the validations are taken care by framework.

regards,

Siva

Former Member
0 Kudos

Simple type based on integer works well if the input field is required field. When it is not required field, framework does not allow an empty string and produces a message :

Empty character string is not a valid value

Any suggestions?