|
Single-line Text Input
| [Previous] [Main] [Next] |
|
| |
| The htmlInputText class is used to define single-line text input areas on a form. When rendered by a browser, such areas appear as rectangles into which text may be typed by a user. You can control the maximum number of characters that are displayed, which can be less than the maximum input length. If the maximum input length differs from the maximum display length, the browser will automatically scroll the region as characters are typed.
| |
|
| |
| htmlInputTextArea objects are added to an htmlForm object using the << insertion operator or the Add() method. As with other form elements, htmlInputText objects have a name parameter, that identifies the value when submitted to a server.
| |
|
| |
| Constructor parameters and methods allow you to specify the following optional values:
| |
|
|
| |
| The htmlInputPassword class is nearly identical to htmlInputText, except that when displayed by a browser, any characters typed by a user appear as asterisks for security. You should note that while any data entered won't be visible to a user, the data is transmitted to the server as unencrypted text which could be visible to electronic eavesdropping. If security is a concern, you should select a server that supports SSL (Secure Sockets Layer) encryption to host your web site.
| |
|
| |
|
| |
| #include <stdio.h>
| |
| #include <stdlib.h>
| |
| #include <dcmicro/htmlpp/htmlpp.h>
| |
|
| |
| int main( void )
| |
| {
| |
| htmlCgi server ;
| |
| htmlPage page( "html++ example application" ) ;
| |
|
| |
| htmlForm form( "/cgi-bin/action.exe" ) ;
| |
| form << "Single-line text input example"
| |
| << htmlParagraph() ;
| |
|
| |
| // Add a control to the form for entering a person's
| |
| // last name. The initial displayed value is specified
| |
| // as the second argument. The control will wide enough
| |
| // to display 15 characters, though up to 30 characters
| |
| // will be allowed for input.
| |
| form << htmlInputText( "last", "Your last name", 15, 30 )
| |
| << htmlBreak() ;
| |
|
| |
| // Add another control for entering a person's
| |
| // last name. This control will be empty, but will
| |
| // have the same display size and maximum input length.
| |
| form << htmlInputText( "first", 15, 30 )
| |
| << htmlBreak() ;
| |
|
| |
| form << htmlInputSubmit() << htmlBreak() ;
| |
|
| |
| page << form ;
| |
|
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
| <FORM ACTION="/cgi-bin/action.exe" METHOD="POST">
| |
| Single-line text input example<P></P>
| |
| <INPUT TYPE="TEXT" NAME="last" VALUE="Your last name" SIZE="15" MAXLENGTH="30"><BR>
| |
| <INPUT TYPE="TEXT" NAME="first" SIZE="15" MAXLENGTH="30"><BR>
| |
| <INPUT TYPE="SUBMIT"><BR>
| |
| </FORM>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
|
| |
