Using Javascript validation

Aug 28, 2015

Hi, I am trying to add validation to a registration form in Articulate using JavaScript.

The validation is working for a date of birth field (checking age over 18, date format, and that data is entered), but if any one of these criteria fails, I want to set focus back on the date of birth textbox.

I have tried using the various document.getElement functions, but none are returning anything.

Is there a way to set focus on a textbox in Articulate? Also, is there anyway to completely stop the course if the DOB field doesn't match the validation criteria? Anything at all that will stop the user from moving forward?

We have triggers set to disable the Next button until the field variable changes (not equal to blank) but we need a way to stop the Next button from initiating if the DOB is in the wrong format or lists an age under 18).

8 Replies
Sheelagh Semper

FYI for anyone else wanting to do something similar, we did find a way to accomplish what we wanted within the confines of Articulate. We weren't able to force the focus on the textbox to do it using just , but we were able to lock down the page to ensure the criteria we wanted to set were met before someone could continue.

We created a validate field that was set to T/F. It was initialized as False and set to True when the text entry variable (DOB) met the criteria set in the Javascript (checking age over 18, date format, and that data is entered). 

We set the NEXT button to enable based on the status of the validate fields, rather than whether or not the text entry variables were not equal to blank.

Christie Pollick

Hi, Gene -- As participants may no longer be subscribed to this somewhat dated thread, you are welcome to reach out directly using the 'Contact Me' link on an individual's profile page. 

Also, as you mentioned the use of JavaScript, I wanted to share that JS is not something we are able to support, but lots of community members are usually more than happy to help. Also, if you'd like to check it out, here is out JS Best Practices sheet. 

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