Data Field Lenght

General discussion forum about all things TD Mobile
fausto.lupercio
Ecuador
Posts: 2
Joined: 18 Sep 2017, 15:38
Location: Quito

Data Field Lenght

Post by fausto.lupercio » 13 Jun 2018, 18:28

Hi

How can I specify the length of characters allowed in a data field?

Thanks
Fausto.

Harald
Germany
Posts: 10
Joined: 30 Mar 2017, 06:16
Location: Oberhaching/Munich, Germany

Re: Data Field Lenght

Post by Harald » 13 Jun 2018, 21:08

Hello Fausto,

at compile time in the properties of the data field, at runtime with

Call SalSetMaxDataLength( <hWndItem>, <length> )

Kind regards
Harald

fausto.lupercio
Ecuador
Posts: 2
Joined: 18 Sep 2017, 15:38
Location: Quito

Re: Data Field Lenght

Post by fausto.lupercio » 13 Jun 2018, 21:26

Thanks Harald,

In TDMobile we don't have hWndItem… I need for Data Field in TDMobile …

Maybe with ccs or js ..?

Thanks in advance.

FRBhote
India
Posts: 85
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Data Field Lenght

Post by FRBhote » 14 Jun 2018, 06:00

Perhaps on Change call an operation to check the length?

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 124
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: Data Field Lenght

Post by Igor Ivanovic » 15 Jun 2018, 08:23

Hi Fausto,

There is no direct way for specifying it in TDMobile as in TD.
The way FRBhote suggested is the right way.
You could also set a validation rule for the bind (IsLessThenOrEqualTo: number) but it will only display an error message you entered when the user is over the limit, and it will still allow more characters to be entered.
Not so elegant I know, but I am using it with some success.
Igor Ivanovic
Image

a_sivababu
India
Posts: 31
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Re: Data Field Lenght

Post by a_sivababu » 15 Jun 2018, 13:44

you can probably try with below way. it might work!

1. you just create javascript function for that page and add the below lines. the first line for max length and second line for to just use the text in red. both .attr and .prop are same use only but .prop can be used in higher jquery version.

$("#df1").prop("maxlength", 5);
$("#df1").attr('style', 'color:red');

2. call this javascript function in " On Create" of the data field. I have given sample with data field as df1. so replace with your datafield name in the above one.

However, as both Igor and FRBhote said, you can always have second level of validation in Service operation for security reason as Client coding can be hacked easily.

Thanks
Siva A

Return to “General Discussion”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests