Formatting Data Entry Fields to Date Entries

Aug 11, 2014

Hello all,

Been trying to figure out a way to format a Data Entry Field to mimic that of a Date Entry.

For example:

dd/mm/yyyy - The user does not input the /, only the numbers when entering a date.

Not sure if this is possible. The only option I've come up with so far is to include the /'s behind the Data Entry field so they appear in the background. Only issue with this is, the spacing of the numbers doesn't quite give enough room for the /'s and it looks kind of messy.

Looking for creative ideas to get over this hurdle, any thoughts?

Many thanks in advance,

W

4 Replies
onEnterFrame (James Kingsley)

You could pipe the user's entry out to JavaScript and validate (or correct) it. Then prompt the user.

You would have a hard time restricting the input because the variable is not updated 'on-the-fly'; you have to wait for the user to click off the field.

Two other possible solutions (both sort of complicated):

  • Use three numeric entry fields (with / between them). Then pipe them to a JS function which puts them together in your desired format and updates another SL variable.
  • Create an HTML page with an input field and JS to to validate/restrict data entry. Then embed the HTML as a Web Object. The page's JS would update the SL variable.

Hope that helps,

jK

Wyeth Krauchi

Greetings JK!

Many thanks for your response! Wanting to get my feet wet with Javascript anyhoo, so why not take the plunge hey?!

I like your idea to link the three entry fields with JS and SL variables, I think I'll try that. As for the specific code...well, off on another adventure. We'll see where that leads.

Again, thanks for the ideas,

W

DeAnn Allen

Wahty Krauchi said:

Greetings JK!

Many thanks for your response! Wanting to get my feet wet with Javascript anyhoo, so why not take the plunge hey?!

I like your idea to link the three entry fields with JS and SL variables, I think I'll try that. As for the specific code...well, off on another adventure. We'll see where that leads.

Again, thanks for the ideas,

W


Like you, I am hoping to get my feet wet with JavaScript very soon. I like the idea as well. If you are pressed for time, however, and your goal is only to display the date, not necessarily to retain it as one variable for later, you could also do the first part of JK's suggestion and create three separate numeric entry fields with the forward slash separating them. Then, when you display the date, create a text box and reference all three variables again with the forward slash (/) separating each reference.

Good luck either way!

Wyeth Krauchi

Thanks DeAnn!

I'll give that solution a try as well.

For this particular exercise the date must be retained for certain references/variables throughout the course. I'm revising my prototype after several 'beta-testers' were unsure how to complete a date field. Unfortunately, learner's are only required to enter the digits in the actual software app, but are required to enter the /'s to verify the answer in the prototype I've replicated in Storyline.

Ah, the joys of developing training, forever looking for solutions.

Safe travels in your JavaScript journey!

This discussion is closed. You can start a new discussion or contact Articulate Support.