case 'space': $page->Paragraph(' '); break; default: if (isset($data['text'])) { $page->Paragraph($mask->ReplaceKeywords($data['text'])); } else { $page->Paragraph(' '); } break; } } // If current step, or some inputs are invalid, or no data has yet been displayed - prompt the step if ($step == STEP_ADDEDINFO || $hasErrors || !HasAnyAdditionalStepValueBeenPostedYet()) { // Do not show any info or success if this is "first show" if (HasAnyAdditionalStepValueBeenPostedYet()) { // Determine the box to show if ($hasErrors) { $page->InfoBox('The form has not been properly filled out!'); } else { $page->SuccessBox('Inputs are accepted, please continue to the next step'); } // Pop it out of the queue and insert at top $page->UpdateQueueAtIndex($msgBoxIndex, $page->PopQueue()); } // Close the form and offer next and previous like in any other steps $prev = GetPrevStep(STEP_ADDEDINFO); if ($prev) { $page->FormButton('Back', array('step' => $prev)); } $page->FormSubmit('Next');
/** * Evaluate text input controls (DOM objects, components or what ever you like to call them) * on the page and display warning boxes if is invalid */ function HasTextInputErrors($data, $value) { global $page; // Do not even evaluate if no value has yet to be posted if (!HasAnyAdditionalStepValueBeenPostedYet()) { return false; } // Only check textboxes and textareas if (isset($data['type']) && ($data['type'] == 'textbox' || $data['type'] == 'textarea')) { // If the box must be filled with some value $mustfill = isset($data['mustfill']) && $data['mustfill'] === true ? true : false; // Numeric value if (isset($data['numeric']) && $data['numeric'] === true) { // Minval defines the lowest accepted value, and maxval the maximum accepted value $minval = isset($data['minval']) && is_numeric($data['minval']) ? $data['minval'] : false; $maxval = isset($data['maxval']) && is_numeric($data['maxval']) ? $data['maxval'] : false; // Check numeric bounds $errorMsg = IsNumericInBounds($value, $minval, $maxval, $mustfill); if ($errorMsg == '') { return false; } else { $page->WarningBox($errorMsg); return true; } } else { $MAX = 2147483647; // If minlen is set, it must be 0 or higher. 1 or higher if "mustfill" flag is enabled if ($mustfill) { $minlen = isset($data['minlen']) && $data['minlen'] > 0 ? $data['minlen'] : 1; } else { $minlen = isset($data['minlen']) && $data['minlen'] >= 0 ? $data['minlen'] : false; } // If maxlen is set, it must be equal-or-higher than minlen, othervice just very very hight number $maxlen = isset($data['maxlen']) && $data['maxlen'] >= $minlen ? $data['maxlen'] : false; // Check string bounds $errorMsg = IsStringInBounds($value, $minlen, $maxlen, $mustfill); if ($errorMsg == '') { return false; } else { $page->WarningBox($errorMsg); return true; } } } return false; }