cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with time input field

younes_talha
Explorer
0 Kudos

Hi,

I have an input field which mapped to a context attribute of type Time. When I try to enter any value during runtime I have a small message in the bottom of my webpage ( Error during parse, please give a value in form 10:11:12 AM ). After that I should enter a good value otherwise I cannot do any other action.

Thanks,

Younes

Accepted Solutions (0)

Answers (4)

Answers (4)

younes_talha
Explorer
0 Kudos

Hi,

Thanks a lot, I managed to make it work.

Younes

younes_talha
Explorer
0 Kudos

Hi,

I am sorry I didnot explain my problem very well. When I try to enter a Time I can only enter "hh:mm:ss" (8 characters) and the webpage asks me to enter "hh:mm:ss AM" (11 Characters). I concluded that the inputfield for the Time is too short. I changed length attribute of this Time inputfield but it doesnot change anything. How can I make It work?

regards,

Younes

Former Member
0 Kudos

Hi Younes,

as Bertram already said correctly, it's enough to create a simple type with builtin type "time" in the local dictionary, set the format pattern to whatever is reasonable in your current scenario and use this type as the dictionary type of the corresponding context attribute.

If the validation logic of the builtin type time expects 11 characters but you can only enter 8, this might be a bug in your WD version (especially the CSF/SSR part). But anyway, specifying a format pattern like described above should fix the problem.

Hope that helps.

Regards

Stefan

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Younes,

that's the purpose of implicit validation based on the dictionary type definition.

By default the format of the built-in type 'time' is "<b>hh:mm:ss a</b>" but you can easily change this format by defining your own simple data type. Name this local dictionary type <i>MyTime</i>, select the built-in type 'time' and then specifiy its <i>format</i> (tab 'Representation') via "<b>hh:mm</b>". In this case the generic validation will accept '12:10' as input field value.

For more details look at http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html

Greetings, Bertram

Former Member
0 Kudos

So, what is the problem???

This is behavior by design -- to validate input.

If you don't like such validation bind your input to String attribute. Or, you can surround original Time attribute with calculated String attribute (with setter/getter) and parse / format data on your own. Or you can set non-validating flag for certain action and perform validation on your own in this action handler.

VS

Former Member
0 Kudos

Valery you have become a fan of the calculated attribute

:B

Regards

Pran

Former Member
0 Kudos

After Bertram's answer I've realized that I start really to see everything like in a nail with this hammer in hand

VS