Validating textbox prompts
Let's say there is a report with a textbox prompt. Users are expected to enter a phone number in (nnn) nnn-nnnn format in that prompt.
In this recipe, we will write a code to validate the value entered by the user and submit the report only if the value entered is in the specified format.
Getting ready
Pick any report and add a textbox prompt to it. We will add a JavaScript to validate that textbox.
How to do it...
We want to make sure that the user will write the phone number in the right format. So, we will validate the number entered by the user using JavaScripts, and in case the number is not following the required format, a warning message will appear to the user with the correct format. To do this, perform the following steps:
Wrap the textbox prompt within a span in the same way as we did in prior recipes.
Add the following script to the page footer:
<script> function ValidatePage() { var theSpan = document.getElementById("A1"); var a = theSpan.getElementsByTagName...