%CSP.Request Example: Form Fields
The example CSP page, SignIn.csp, contains the following form (See the note below for the location of SignIn.csp):
<!--Code not for use as CSP Application Login page-->
<form name="edit" method="post" action="StateTest.CSP">
<p>User Name: <input type="text" name="txtUserName"></p>
<p>Password: <input type="text" name="txtPassword"></p>
<p><input type="submit" name="btnSignIn" value="SignIn" ></p>
</form>
When the user submits the form, that is clicks the Submit button, the browser requests StateTest.CSP. The %request variable passed to the page contains the values entered into the form fields on SignIn.CSP.
Complete the following steps to test %request:
-
Using Studio, create StateTest.CSP in csp/user
-
Add the following code to the <BODY> section of StateTest.CSP. This code retrieves and displays the values from the SignIn.CSP form fields that are stored in %request.
<p>User Name: #($Get(%request.Data("txtUserName",1)))#</p> <p>Password: #($Get(%request.Data("txtPassword",1)))#</p>
-
Open SignIn.CSP in a browser. Enter some text in the form fields.
-
Click SignIn. StateTest.CSP displays the values entered into the SignIn.CSP form fields.
SignIn.CSP cannot be used as a login page for a CSP application.
SignIn.CSP is one of the example files that accompany the tutorial. For information on installing the example files, read Installing Tutorial Files.