Usage Note 23670: How can I create HTML forms with ODS?
You can add an HTML form to any part of the HTML file by
using PROC TEMPLATE or the DATA
step. Below is an example of creating a form in the
DATA step by using ODS. First, PROC TEMPLATE
adds JavaScript to the Onload handler. The TAGATTR= value
specifies the text field in which to place the cursor when the
browser is loaded. In this case, it is NAME, which is
assigned later in the DATA step to the first field, "Name:".
In the DATA step, the TABINDEX= attributes specify the order
to follow when the user presses the Tab key to advance the cursor to
the next field.
The ACTION= option specifies what to do
when the user selects the Submit button. In this case, the values
from all the fields are
sent to an e-mail address.
However, the ACTION= value doesn't have to be an e-mail address; it can be any
CGI program you want.
View output.
proc template;
define style styles.test;
parent=styles.default;
style batch from batch /
frame=void
protectspecialchars=off;
style startupfunction from startupfunction /
tagattr='document.all.name.focus()';
end;
run;
ods html file='temp.html' style=styles.test;
options ls=132;
data one;
file print;
put '<form method=post ENCTYPE="text/plain"
ACTION="mailto:person@company.com">';
put '<fieldset>';
put '<legend> Customer Information </legend>';
put '<P> Name: <input type="text" NAME="name" TABINDEX=1>
Age: <input type="text" size=3 NAME="age" TABINDEX=2>';
put '<BR>';
put '<P> SEX: <input type="text" NAME="sex" TABINDEX=3 >
HEIGHT: <input type="text" size=3 NAME="height" TABINDEX=4>';
put '<BR>';
put '<p> WEIGHT: <input type="text" NAME="weight" TABINDEX=5>';
put '</fieldset>';
put '<fieldset>';
put '<legend align=right> Please input </legend>';
put 'input comments to be displayed';
put '<TEXTAREA COLS="40" ROWS="7" NAME="comments" WRAP>
Please enter comments</textarea>';
put '</fieldset><br>'
'<INPUT TYPE="submit" NAME="submit" VALUE="SUBMIT">';
put '</form>';
;
run;
ods html close;
See also the full PROC TEMPLATE FAQ and Concepts.
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Usage Note |
| Priority: | low |
| Topic: | SAS Reference ==> ODS (Output Delivery System) SAS Reference ==> DATA Step Third Party ==> Programming ==> JavaScript
|
| Date Modified: | 2005-12-16 10:57:53 |
| Date Created: | 2004-02-04 10:46:02 |