Validating content in textboxes

I have a course that requires some user entered variables to generate a certificate of completion at the end and parses the user enter text and quiz results to an in-house database. 

JavaScript is used to validate the content of the individual fields, checking to ensure text is entered in a specified format and that the required fields are not left blank. An alert message appears if these conditions are not met.

The individual text entry boxes are set to run the JavaScript first, then set the variable to equal the typed value when control loses focus. 

I then created a count so that as each required variable changes (e.g. is completed) 1.0 is added to the slide count variable. When that variable is equal to 5, the NEXT button is enabled. This is set as a slide trigger.

In theory it works beautifully.

However - I've hit a snag with the count variable. 

  • IF an individual types content into a field and receives an error message, AND 
  • IF they click OK on the JavaScript alert message, AND 
  • IF they then delete the contents of the field and leave the field blank (or enter content in the field that's incorrect) they will see another alert message relating to the formatting. 
  • BUT the count has already added +1.0 to the count variable at this point. If the field is left empty, or the formatting is wrong in the field, the NEXT button is still enabled, allowing the user to move along in the course.

This becomes an issue when the user attempts to finish the course; the data is never posted to the database. 

Is there a way to set a trigger condition to check to see if the field is blank?

 

 

 

 

 

7 Replies
Sheelagh Semper

The problem I have with that option is that if the field is filled incorrectly (sending data to the variable), then wiped blank, the count has already occurred. If the person moves on to a new field, the NEXT button is enabled once the count of 5 is reached. This is allowing people to move on in the course but causing the data not to transfer to the database when the course is completed, and blank fields to print on the certificate of completion.

I had originally set the triggers up as:

Add 1.00 to Scene1Slide5 when UNF changes is UNF is not equal to, ignore case (blank) (x4 other variables)

Set Scene1Slide5Complete equal to True when Secen1Slide5 changes 
If Scene1Slide5 is Greater than or equal to 5.00

Change state of next button to Normal when Scene1Slide5Complete changes
If Scene1Slide5Complete is equal to, ignore case True

And the individual required fields are set up to run the Javascript first (checks for valid characters and that data has been entered), then the next trigger sets the variable content based on what the user enters.

Set UNF equal to the typed value
When the control loses focus 

 

 

 

Sheelagh Semper

I'll let you know. So far, I'm not having the best of luck locking down the Next button. I'm wondering if I should tie the triggers or JavaScript to a Submit button and tie the Next button's state to the results of the Submit?

In theory subtracting 1.00 when the variable changes and field is left blank works, but only if the person deletes the variables content before moving on to another field. Which of course, now that I know it's a possibility, no matter how unlikely, I need to fix it before releasing into the wild.