ubError+Checking+-+Integer

In the fall of 2010, a tool was developed that will turn any regular textfield (or ubFramedText) into an "Integer Input box", which can automatically handle error checking. Details are available to programmers on the ZenDocs on how to incorporate this tool into CLIPS activities. The purpose of this wiki page is to outline how it works for Storyboarders.

An Integer Input box will check its contents every time something changes in the input box (a character has been added or deleted). An event is broadcast that programmers can respond to immediately, or after a specified time period or action has occurred. This means that it is possible to program instant feedback as soon as a student has entered an answer or an incorrect response or invalid number. This type of instant feedback is used in the Integer Comparison Tool (though technically this wasn't done with an Integer Input box using the ubError checking, it functions identically.)

The more common usage is that the contents of input boxes (Integer Input boxes among them) is checked only when the student clicks the **Check** button. (See almost any other activity to see how this works.)

* Ensure input is valid and provide indicated feedback before dealing with the activity specific feedback. * For input do not accept the following: Letters, symbols and decimal numbers - accept only +, - , 0, 1,2,3,4,5,6,7,8,9 (Thus, things like ‘k’ ‘2.0’ and 2/1 do not need to have feedback attached to it.)
 * Integer Input box standards**:

**Timing of feedback:** The programmer retains the right to decide when the feedback is best given. For some activities, it might make sense for some feedback to appear immediately upon entry. //(e.g., a tool or calculation or graphic display is dependent on valid input, and if an invalid numbers entered into an input box forces a non-true expression or representation to appear, a warning message might be appropriate immediately to alert students to this)// Generally, we probably want to give students time to think about what they are entering and possibly change their mind, so feedback should happen after an "Enter" key or "Check" Button is hit. This will be the default chosen and assumed by programmers unless a storyboarder states otherwise.

**Counting error attempts:** Invalid entries should generally not count as an error when keeping track of number of attempts. The students are giving a chance to re-enter a number in proper format without penalty. However, if there is a limit to the number of mal-formed number attempts that you wish to allow in a particular scene, please specify that in your storyboard (or better yet, if this is an issue of concern, come up with a cluster-specific max number of invalid entries attempts that can be used.)


 * Examples of input** that will generate automatic feedback in a standard Integer Input box (cases no longer needed in storyboard feedback table, unless changes to the standard are required for some reason.) //NOTE: We reserve the right to chage the wording to make it more concise and user-friendly//

SAMPLE ERROR ERRROR ERROR INPUT NUMBER CODE MESSAGE

 23 # 0 : OK : Number is OK.

 # 11 : ubWARNING_NULL : Warning: Entry is blank.  + # 21 : ubWARNING_NODIGITS : Warning: Entry has no digits (should have at least one character from 0 to 9).  00 # 31 : ubWARNING_MULTI_ZEROES : Warning: More than one zero entered (the value of zero should be expressed with a single 0).  007 # 32 : ubWARNING_LEADING_ZERO : Warning: Zero entered in front of number (a positive number does not need a leading zero).

 4+ # 51 : ubERR_SGN_PLUS_AFTERNUM : Positive sign is after number (should be before).  7- # 52 : ubERR_SGN_MINUS_AFTERNUM : Negative sign is after number (should be before).  +0 # 61 : ubERR_SGN_PLUS_ZERO : Zero is written with a positive sign (should have no sign).  -0 # 62 : ubERR_SGN_MINUS_ZERO : Zero is written with a negative sign (should have no sign).  ++4 # 71 : ubERR_SGN_DBLPLUS : Number has more than one positive sign (should have only one).  --9 # 72 : ubERR_SGN_DBLMINUS : Number has more than one negative sign (should have only one).  +-1 # 73 : ubERR_SGN_DBLSIGNS : Number has more than one sign (should have only one, either positive or negative).  ---4 # 74 : ubERR_SGN_MULTISIGNS : Number has multiple signs (should have only one, either positive or negative).  4+3 # 81 : ubERR_SGN_MISPLACED_PLUS : Number has misplaced positive sign (should be at front of number). <span style="font-family: 'Courier New',Courier,monospace; font-size: 80%;"> 2-9 # 82 : ubERR_SGN_MISPLACED_MINUS : Number has misplaced negative sign (should be at front of number). <span style="font-family: 'Courier New',Courier,monospace; font-size: 80%;"> 3-4+ # 83 : ubERR_SGN_MISPLACED_SIGNS : Number has misplaced signs (should be only one, at front of number).

Assuming ubMin = -5 and ubMax = 99 then the following error messages are also possible <span style="font-family: 'Courier New',Courier,monospace; font-size: 80%;"> -10 # 101 : ubERR_NUM_TOOLOW : Number is too low. <span style="font-family: 'Courier New',Courier,monospace; font-size: 80%;"> 121 # 102 : ubERR_NUM_TOOHIGH : Number is too high.

//Note about organization and type of error messages:// //Warnings may or may not indicate errors ... they may indicate the correct number is "in progress", ie, the student is in the act of entering a correct number.// //Sign errors are searched for and addressed first. If there are no sign errors, then the number is checked to see if it is within the correct range.//

Refer to the [|DemoOpTools.swf] to see how the ubError Checker works. - Scene 13 is for integer input. - Scene 8 is for fraction input (still under construction)
 * See this in action:**

See what feedback will be given under different conditions. TO SEE FEEDBACK FOR INVALID ENTRIES
 * Crystal's Guided Tour:**
 * Set the ubMin & ubMax values in those input boxes.
 * Set all radio buttons to validate (this will allow you to enter invalid input and see what feedback would be given.)
 * If you're in the fraction tester set the fraction type.
 * Type a number into the input box and the feedback will appear in the bottom left hand text field. (e.g. try --3, 007, -4-, 3+, etc, and numbers that are outside of the max and min you set earlier)

TO SEE WHAT HAPPENS WHEN you RESTRICT the text field to ONLY allow the user to enter VALID input:
 * Set all radio buttons to restrict. (e.g. if you set ubMin to be -5 and ubMax to be 5, then you will not be able to enter -7 or 52)


 * To see all types of feedback for invalid input, press the **little i button** in the top right hand corner.


 * HELP on understanding SETTINGS** (blue box at top of scene 8 and scene 15)

ubMin = minimum value allowed for integer (ubMin is used by programmers so as not to conflict with any other variable names) ubMax = maximum value allowed for integer. If blank, +Infinity will be used. (ubMin blank = -Infinity - ie - any negative number is OK)

numDecimals = 0 for all Integer Input boxes (created so this could be extended to real numbers eventually)

checkSign = setting used to determine how vigorous the sign checking routine should be //restrict// --> only valid signs will be allowed, when they would make sense, assuming standard left to right character entry. If the ubMin = 5, then no - sign will be allowed, for example. Once a + has been entered (optional), no second + would be allowed. //restrictNone// --> NO signs are allowed in the input field. This setting could be used to force pure unsigned Whole number input. (This may be a desired setting for certain fraction types or fraction fields) //validate// --> character entry is open to all legit characters: 0-9, +, -, but after each change in the input field, an error message is generated based on the validity of the input. Given the above example, a - would be allowed even with an ubMin of 5, and ++7 could also be entered - but both would generate error messages. (note: if checkNum is still on restrict, then double sign entry will still be restricted) //none// --> no error checking is performed. Character entry is open to all characters, and no error message is generated.

checkNum = setting used to determine how vigorous the number checking routine should be //restrict//--> only valid numbers will be allowed, when they would make sense, assuming standard left to right character entry. If the ubMin = 5, and ubMax = 47 then you could enter a 4 .. then a 6 (to get 46), but not a 4 then a 9 (since that would make 49). You could enter a 5, but no other digit afterwards (would make a number in the 50s, too high) //restrictNone// --> NO digits are allowed in the input field. This setting could be used to force the field to be used only for + or - signs (strange but true) //validate// --> character entry is open to all legit characters: 0-9, +, -, but after each change in the input field, an error message is generated based on the validity of the input. Given the above example, a - would be allowed even with an ubMin of 5, and ubMax of 47, 49 and 53 would all be allowed, but both would generate error messages. //none// --> no error checking is performed. Character entry is open to all characters, and no error message is generated.

Feedback used in the Integer Comparison Tool
 * ** Invalid input ** || ** Feedback ** || ** Action ** || ** Suggestions for timing of feedback ** ||
 * 2- or 2+ || // The <“+” /“-“ // > sign is written before the number, re-enter starting with the sign. || Highlight the input box

Make sure +/- signs are in quotes throughout feedback. || As soon as the sign part of the number is entered || +-2, --2, ++2, -+2 || An integer has only one sign. Enter an integer. || Highlight input box || After the second sign is entered || This is a matter of standard format, not an error. || After the first non-zero digit is entered || 6++ 2-+4  2 - 4 || Enter a valid integer. || Highlight input box ||  ||
 * + or - || Enter a number after the <//“+”/ “-“> sign.// || Place cursor in textbox after the sign || After submitted ||
 * +0 or -0 || Zero is neither positive nor negative. Try again. || Rest the focus, require the user to enter a different value. || As soon as the zero is entered ||
 * Double signs for example:
 * 09, -03, +007 || Leading zeros are not necessary. || Action should proceed as if they entered 9, -3, or 7. (Replace values where appropriate.)
 * Anything else strange,
 * +2 versus 2 ||  || Treat as if they were the same unless specifically instructed otherwise in the storyboard. ||   ||