Skip to Content

Problem with time input field

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 16, 2004 at 01:36 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 16, 2004 at 03:10 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 17, 2004 at 10:02 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Posted on Dec 20, 2004 at 12:03 PM

    Hi,

    Thanks a lot, I managed to make it work.

    Younes

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.