cancel
Showing results for 
Search instead for 
Did you mean: 

Date and Time Input Validation

Former Member
0 Kudos

Anyone know a good way to validate date and time that a user is entering on the screen. Our users want to enter AM and PM time vs. Military time.

Also, since Input fields don't have an "onBlur" command, what are other companies using in java script.

Accepted Solutions (0)

Answers (2)

Answers (2)

Ulli_Hoffmann
Contributor
0 Kudos

Hi Anthony,

try these two function modules:

CONVERT_TIME_INPUT

CONVERT_DATE_TO_INTERNAL

Check results depend on time zone system settings or user settings in su01

regards, Ulli

Former Member
0 Kudos

Good to know the issue is across the baord. We are currently using both those function modules but unfortunately you can only trap what they enter and then display an error message.

So, anyone know how to give an input field a dropdown that calls an SAP function module? DD_SHLP_CALL_FROM_DYNP

Former Member
0 Kudos

Have you played with the "TYPE" setting for hte inputfield?

athavanraja
Active Contributor
0 Kudos

What type of DATE/TIME validation are you looking for?

If you want to validate the format you could simply set the type to date/time and enable the dovalidate attribute to "TRUE".

for getting onBlur, onChange, etc for your input field you can use bsp:findandreplace.


   <%
  tmp_string =`<input onBlur="javascript:yourjsfunction();"`.
      %>
      <bsp:findAndReplace find    = "<input"
                          replace = "<%= tmp_string %>" >
        <htmlb:inputField id        = "myInputField2"
                          value     = "12345"
                          alignment = "left" />
      </bsp:findAndReplace>

(courtesy Ulli Hoffmann)

Hope this helps.

Regards

Raja

Former Member
0 Kudos

thanks for the help guys

Former Member
0 Kudos

Don't forget to mark this problem as solved so others can find solutions faster in the future.

Former Member
0 Kudos

We had a similiar problem.

We read the inputfield as a string and simply used string manipulation to alter the time format. We knew there was a : and AM or PM or am or PM so we just played around, we eventually changed it to force military time format due to type errors and people using a mix of time formats.